attributes.py
class Point: pass p1 = Point() p2 = Point() p1.x = 5 p1.y = 4 p2.x = 3 p2.y = 6 print(p1.x, p1.y) print(p2.x, p2.y)
first_method.py
class Point: def reset(self): self.x = 0 self.y = 0 p = Point() p.reset() print(p.x, p.y)
2023-12-26 21:04:39
attributes.py
class Point: pass p1 = Point() p2 = Point() p1.x = 5 p1.y = 4 p2.x = 3 p2.y = 6 print(p1.x, p1.y) print(p2.x, p2.y)
first_method.py
class Point: def reset(self): self.x = 0 self.y = 0 p = Point() p.reset() print(p.x, p.y)