SHARE
TWEET

Untitled

a guest Apr 25th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top