Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- class position():
- def __init__(self, x, y):
- self.x = x
- self.y = y
- def distance_from_origin(self):
- return math.sqrt((self.x * self.x) + (self.y * self.y))
- def __str__(self):
- return "(" + self.x + ", " + self.y + ")"
- def __eq__(self, other):
- return (self.x == other.x and self.y == other.y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement