Improve the constructor in Exer. 7.5. The constructor in class Line in Exercise 7.5 takes two points as arguments. Now we want to have more flexibility in the way we specify a straight line: we can give two points, a point and a slope, or a slope and the line’s interception with the y axis. Hint: Let the constructor take two arguments p1 and p2 as before, and test with isinstance whether the arguments are float or tuple/list to determine what kind of data the user supplies:
Exercise 7.5
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here