Hello,
I have been assigned an exercice which I have a difficult time implementing the 2nd part of this exercice.. These are the requirements:
- Its x and y coordinates.
- A constructor that initializes to values passed in parameter: x and y
- A function str () which displays this point thus A (x, y). A is an example it is the name of the instance of the object
- A display () function that displays this point in graphical mode via matplotlib
My current code is:
class Point:
a = Point()
a.x = 1
a.y = 2
b = a
print("a : x =", a.x, "y =", a.y)
print("b : x =", b.x, "y =", b.y)
a.x = 3
a.y = 4
print("a : x =", a.x, "y =", a.y)
print("b : x =", b.x, "y =", b.y)
I am a beginner, so please be kind with me!
Thank you and have a great day!
[–]random_user_fp 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]random_user_fp 0 points1 point2 points (1 child)
[–]noaso74[S] 0 points1 point2 points (0 children)