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]small heal 5 gold\n[2]moderate heal 20 gold\n[3]large heal 100 gold\n[4]small strenth boost 50 gold\n[5]moderate strenth boost 200 gold\n[6]large strenth boost 1000 gold\n[7]small maxhp boost 500 gold\n[8]moderate maxhp boost 2000 gold\n[9]large maxhp boost 10000 gold\n[10]sacrafice 20 hp for 5 gold 20 hp\n\n\nwhatis ur choice')
print('gold:',gold)
shop=input()
if shop=='1':
if gold>="4":
gold-=5
elif shop=='2':
if gold>="19":
gold-=20
elif shop=='3':
if gold >= "99":
gold-=100
elif shop=='4':
if gold >= "49":
gold-=50
elif shop == '5':
if gold>="199":
gold-=200
elif shop == '6':
if gold>="999":
gold-=1000
elif shop == '7':
if gold>="499":
gold-=500
elif shop == '8':
if gold>="1999":
gold-=2000
elif shop == '9':
if gold>="9999":
gold-=10000
elif shop == '10':
hp-=20
gold+=5
print("you sacraficed your health to gain money. not exacly a wise move.")
input()
else:
print('what? thats not a legal input\nnow get out!')
input()
while hp>=maxhp:
hp-=1
while hp<=1:
print("G A M E\n O V E R")
im relatively new to python and i have researched sites with solutions that did not work. i have been using repl.it for this.