Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. class Vector:
  2. def __init__(self, x, y):
  3. self.x = x
  4. self.y = y
  5.  
  6.  
  7. def add(vectorOne, vectorTwo):
  8. x = vectorOne.x + vectorTwo.x
  9. y = vectorOne.y + vectorTwo.y
  10. return Vector(x,y)
  11.  
  12.  
  13. v1 = Vector(1,1)
  14. v2 = Vector(2,2)
  15.  
  16. v3 = add(v1,v2)
  17. print(v3.x,v3.y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement