编写一个循环,提示用户输入一系列的比萨配料,并在用户输入‘quit’时结束循环。每当用户输入一种配料后,都打印一条消息,说我们会在比萨中添加这种配料。
代码:
prompt = "\nPlease enter a pizza topping that you would like to add: "
prompt += "\n(Enter 'quit' when you are finished.) "
message = ''
while message != 'quit':
message = input( prompt)
if message != 'quit':
print("\nWe will add "+message+" into the topping.")
运行结果: