Classes and Objects

4 / 4

Lines are characterized by a slope $a$ and an intercept $b$. A point $(x,y)$ is on the line if $$ y=a\cdot x + b $$

Multiple classes

Create a class Line with:

  1. Constructor taking slope a and intercept b.
  2. Method __str__ returning "y = {a}*x + {b}"
  3. Method contains with parameter p returning True if point p lies on the line
  4. Method intersect with parameter l returning the point on which the line intersects with Line l

Congratulations!

You passed the !

Welcome!

Would you like a guided tour on how to use Vibewise?

Your email has been verified!