+ 12

I need help with the Shooting game (Solved)

I have been stuck on shooting game for hours, I did my code right but it’s not working please give me the answer https://code.sololearn.com/cKqQown88vf7/?ref=app

3rd Sep 2021, 4:39 AM
Makima’s Dog
Makima’s Dog - avatar
6 Réponses
+ 4
Please send your code and then we may be able to help you.
3rd Sep 2021, 5:14 AM
Success Ours
Success Ours - avatar
+ 5
# Corrected Code By Sancho Godinho: class Enemy: name = "" lives = 0 def __init__(self, name, lives): self.name = name self.lives = lives def hit(self): self.lives -= 1 if self.lives <= 0: print(self.name +' kiled') else: print(self.name + ' has '+ str(self.lives)+ ' lives ') m = Enemy('Monster',3) a = Enemy ('Ailen',5) while True: x = input() if x == 'exit': break elif x== 'laser': a.hit() else: m.hit()
12th Sep 2021, 10:46 AM
Sancho Godinho
Sancho Godinho - avatar
+ 3
AkiQ8 You Have Actually Done A Lot Of Mistakes... But, You Can Copy & Paste My Other Answer As Your Code...
12th Sep 2021, 10:48 AM
Sancho Godinho
Sancho Godinho - avatar
+ 3
Thanks all of you for helping me out may Allah bless all of you with heaven
12th Sep 2021, 11:09 AM
Makima’s Dog
Makima’s Dog - avatar
+ 2
AkiQ8 you didn't learned about the the most important and basic thing in python , i.e. Indentation. So i advise you go through thousands of tutorials out there to get a better understanding on how to properly indent your code.
3rd Sep 2021, 8:15 AM
Abhay
Abhay - avatar