def game(): gold = 50 character_hp = 125 weapon_damage = 15 monster_damage = 25 monster_payout = 80 weapons = ["fists"] name = input("\nWhat is your name?\n\n").title() while name == "": name = input("\nWhat is your name?\n\n").title() print("\nWelcome", name, "Enjoy, Your Adventure!\n") store = input("\nDo you want to buy weapons? (yes or no)\n\n").lower() while character_hp > 0: WEAPONS_STORE = { "sword":140, "axe":120, "club": 75, "bat": 25 } if store =="yes": print("\nWEAPONS\t\tCOST\n\n") for items in WEAPONS_STORE: print (items, "\t\t", WEAPONS_STORE[items], "\n") print("\nYou have",gold,"gold\n\n") weapon_purchase = input("Which weapon would you like to buy\n\n") game()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question