赞
踩
源代码如下:
##2019-05-31 ##python available_menus = ('french fries','chicken wings','hamburger', 'egg tart','chicken nuggets') order_dishes = [] order = input("please place the order: ") if order == 'no,thanks': print("you are welcome!") else: while order != 'done': order_dishes.append(str(order)) #这里的str()不可缺少 order= input("any one else do you want: ") for order in order_dishes: if order in available_menus: if order == 'egg tart': print("sorry,we are out of egg tart right now.") else: print("Adding "+order+'.') else: print("Sorry,we don't have "+order+".") print("\nplesase check out your order!")
运行结果如下:
D:\>python restaurant.py
please place the order: no,thanks
you are welcome!
D:\>python resta
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。