p_desktop = 5 p_keyboard = 10 p_mouse = 10 p_monitor = 10 a_desktop = 0 a_keyboard = 0 a_mouse = 0 a_monitor = 0 g_desktop = 0 g_keyboard = 0 g_mouse = 0 g_monitor = 0 popularity = 0 money = 1000 def inventory(): print("Poor desktops: " + p_desktop) print("Poor keyboards: " + p_keyboard) print("Poor mouses: " + p_mouse) print("Poor monitors: " + p_monitor) def game(): print("What do you do?\n") print("1: Advertise (-$500, popularity boost of 10).") print("2: Buy inventory.") print("3: Do nothing.") choice = int(input()) if(choice == 1): money -= 500 popularity += 10 if(choice == 2): if(popularity < 10): if(p_keyboard > 0): p_keyboard -= 1 money += 10 if(p_mouse > 0): p_mouse -= 1 money += 5 print("You started a computer company.") print("You start with an inventory of 5 poor desktops, 10 poor keyboards, 10 poor mouses, and 10 poor monitors.") print("You also start with a balance of $1000. If you go below $0 you will lose the game.\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