Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. class Unit:
  2.     def init(self,unit_type,attack_value,defend_value):
  3.         self.type=str(unit_type)
  4.         self.attack=int(attack_value)
  5.         self.defend=int(defend_value)
  6.  
  7. unit = Unit('tank',9,4)
  8.  
  9. print(unit)
  10. print(unit.type)
  11. print(unit.attack)
  12. print(unit.defend)
  13.  
  14.  
  15. '''
  16. ================== RESTART: C:/dev/python/python_combat.py ==================
  17. Traceback (most recent call last):
  18.  File "C:/dev/python/python_combat.py", line 7, in <module>
  19.    unit = Unit('tank',9,4)
  20. TypeError: Unit() takes no arguments
  21. >>>
  22. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement