on-internet
← Community

i cant get this TypeError fixed [closed]

Stack Overflow ·

error message: `Traceback (most recent call last): File "main.py" line 23, in <module> if gold>="4": TypeError: '>=" not supported between instances of 'int' and 'str'` my code: Code: import random hp=34 maxhp=34 strenth=5 weapon='fist' gold=0 monsters=["goblin","Orc","hobgoblin","dragon","Troll","tarasque"] while hp>=1: print('\ngold:',gold) print('\nhp:',hp) print('\nmaxhp:',maxhp) print('\nstrenth:',strenth) print('\nweapon:',weapon) print("\n\n[1]BATTLE!!!\n[2]shop") answer=input() if answer=='1': random.choice(monsters) elif answer=="2": print('what would nyou like to purchase?\n\n[1]smal

Comments

Sign in or sign up to comment and upvote.

No comments yet.