Advertisement
Guest User

Untitled

a guest
Jul 26th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. ===========================
  2. pClass.py
  3.  
  4. import useClass
  5.  
  6. center = point.Point(0,0)
  7. point_a = point.Point(1,1)
  8.  
  9. print(point_a + " is point a")
  10. print(center + " is the center")
  11.  
  12.  
  13. ========================================
  14. useClass.py
  15.  
  16. class Point:
  17. ''' Represent a point in a Euclidian plane '''
  18.  
  19. def __init__(self, x_coor, y_coor):
  20. self.x = x_coor
  21. self.y = y_coor
  22.  
  23. def coordinates(self:
  24. '''Return a tuple of the x,y coords of a ponit'''
  25. return (self.x, self.y)
  26.  
  27. def move_to(self, x_coor, y_coor):
  28. '''Assign new coordinates to a ponit '''
  29. self.x = x_coor
  30. self.y = y_coor
  31.  
  32. Traceback (most recent call last):
  33. File "useClass.py", line 1, in <module>
  34. import useClass
  35. File "/home/mikey/school/useClass.py", line 3, in <module>
  36. center = useClass.Point(0,0)
  37. AttributeError: module 'useClass' has no attribute 'Point'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement