4.6 input函数
# input函数为python系统函数。
name = input("Please enter your name: ")
print("Hello, " + name.title() + "!")
age = input("How old are you? ") # age is a string.
age = int(age) # Now age is an integer.
if age >= 12 and age < 60:
print('You can ride the roller coaster.')
# 让用户选择何时退出:
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != 'quit':
message = input(prompt)
print(message.upper())
输出结果