def cont(account): prompt = input("Press \"c\" to continue or \"x\" to exit. ") if prompt == "c": part2(account) elif prompt == "x": print("bye!") else: print("Please type either \"c\" or \"x\".") cont() def part2(account): fColor = input("What is your favorite color? ") fFood = input("What is your favorite food? ") #account.insert(0,fname) account.insert(2,fColor) account.insert(3,fFood) print("Thank you! Here's your summary, ") print(account) def start(): register = input("Do you want to register? Type y for yes or n for no. ") if register == "y": reg() elif register == "n": print("bye!") else: start() def reg(): account = [""] fname = input("What is your name? ") account.insert(0,fname) bYear = int(input('What\'s your date of birth? ')) age = 2017 - bYear account.insert(1,age) if age <= 17: print("You are under age!") else: cont(account) start()
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