0
why is there indention error?
import random as r num = 1 health = 1000 ehealth = 1000 if num==1: print("") while health > 0: dam = r.randint(25, 50) crit = r.randint(25, 30) edam = r.randint(25, 50) crit = r.randint(25, 30) print("You do ", dam, "damage") ehealth = ehealth - dam print("Your enemy does ", edam, "damage") health = health - edam if ehealth<=0: print("You Won! Please leave a like") elif ehealth<=0: break elif health<=0: print("You lost. Please try again.") elif health<=0: break
4 Réponses
+ 7
If a line ends in a colon, the next line must be indented.
+ 2
#Maybe you mean this
import random as r
num = 1
health = 1000
ehealth = 1000
if num==1:
print("")
while health > 0:
dam = r.randint(25, 50)
crit = r.randint(25, 30)
edam = r.randint(25, 50)
crit = r.randint(25, 30)
print("You do ", dam, "damage")
ehealth = ehealth - dam
print("Your enemy does ", edam, "damage")
health = health - edam
if ehealth<=0:
print("You Won! Please leave a like")
elif ehealth<=0:
break
elif health<=0:
print("You lost. Please try again.")
elif health<=0:
break
+ 1
It's at elif ehealth <=0:
Break
0
Ill try that. Thx!