Advertisement
George_Ivanov05

Untitled

Jul 18th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. class Weapon:
  2.     def __init__(self, bullets):
  3.         self.bullets = int(bullets)
  4.  
  5.     def shoot(self):
  6.         if self.bullets > 0:
  7.             self.bullets -= 1
  8.             return 'shooting...'
  9.         else:
  10.             return 'no bullets left'
  11.  
  12.     def __repr__(self):
  13.         return f'Remaining bullets: {self.bullets}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement