dimanche 26 juin 2016

If statement needs indentation when it doesn't

So when I run my code, it says 'expected indentation' but I can't see why.

    #Attack A   
if round_1_enemy_attack == 'a':
    print ("The monster uses slash")
    print ("Your health value is now:")
    print (hp-dmg_a)
    #End Attack A
        #User Health Check
    if hp < 0:
        print("The monster has killed you")
        user_lose = True
    else:
        #End User Health Check 
    #Attack B
elif attack == 'b':
    print ("The monster uses spit")
    (hp-dmg_b)
    print ("Your health value is now:")
    print (hp-dmg_b)
    #End Attack B
        #User Health Check
    if hp < 0:
        print("The monster has killed you")
        user_lose = True
    else:
        #End User Health Check
    #Attack C
elif attack == 'c':
    print ("The monster uses bite")
    (hp-dmg_c)
    print ("Your health value is now:")
    print (hp-dmg_c)
    #End Attack C
        #User Health Check
if hp < 0:
    print("The monster has killed you")
    user_lose = True
else:
    #End User Health Check

The error comes up at 'elif attack == 'b':'. After the colon, it's just a red highlight. I know my code is pretty bad but I'm pretty sure that part is right.

Aucun commentaire:

Enregistrer un commentaire