def start(): print("Type 'begin' when you are ready to start.") begin; while begin != "begin": begin=input("") print "OK. Let's get started!" username=input("What will your username be? ") password=input("... and password? ") print"Great you're all set! Now to the game!" game(username,password) def game(user,pwd): coins=100 print("Welcome "+user+"!") print("You have just moved into a new house and are starting a new life, now there is only one thing left to do...") print("GET A PET!!!!!!") pet_type=input("You have 100 coins. Would you like a cat for 17 coins, a dog for 17 coins, a fish for 10 coins, or a parrot for 13 coins?").lower() if pet_type == "cat": coins-=17 catverse(user,pwd,coins) elif pet_type == "dog": cons-=17 dogverse(user,pwd,coins) def catverse(user,pwd,coins): print"CATS" print user+","+pwd+","+str(coins) def dogverse(user,pwd,coins): print"DOGS" print user+","+pwd+","+str(coins)
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