Lowest price ever! Learn Generative AI for 48% less!
Get my discount0
I need help
So in the last line I can't subtract the health from the damage. Pls explain why😐 hp = 5 exp = 0 import random monster =(random.randint(1, 3)) mob =() mob_HP = 5 damage =(random.randint(1, 5)) if monster==1: mob ='giant' if monster==2: mob ='cyclopes' if monster==3: mob ='hydra' print("oh no! a",mob,"is blocking the path! you must kill it!") if damage>=3: print("critical damage!") print("you do",damage,"damage") if mob_Hp<=5: mob_Hp =(mob_HP - damage)
1 Answer
+ 1
It's simple, python variables are case sensitives so monster_HP and monster_Hp are not considered to be the same thing, you should correct that statement so that all the monster_HP variables are written HP and not Hp, or viceversa: correct all of it to Hp instead of HP