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

3rd Jun 2018, 7:53 PM
Random test
4 Réponses
+ 7
If a line ends in a colon, the next line must be indented.
4th Jun 2018, 6:50 AM
David Ashton
David Ashton - avatar
+ 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
3rd Jun 2018, 8:09 PM
李立威
+ 1
It's at elif ehealth <=0: Break
3rd Jun 2018, 7:55 PM
Random test
0
Ill try that. Thx!
3rd Jun 2018, 8:12 PM
Random test