Advertisement
DiYane

Weapon

Sep 25th, 2023
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. class Weapon:
  2.     def __init__(self, bullets):
  3.         self.bullets = bullets
  4.  
  5.     def shoot(self):
  6.         if self.bullets > 0:
  7.             self.bullets -= 1
  8.             return "shooting..."
  9.         return "no bullets left"
  10.  
  11.     def __repr__(self):
  12.         return f"Remaining bullets: {self.bullets}"
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement