sandwich_orders = ['火腿三明治','鸡蛋三明治','青菜三明治',
'pastrami','pastrami','pastrami']
finished_sandwiches = []
while sandwich_orders:
sandwich = sandwich_orders.pop()
print ('\n您好,您点的 ' + sandwich.title()+' 做好了.' )
finished_sandwiches.append(sandwich)
while 'pastrami' in finished_sandwiches:
finished_sandwiches.remove('pastrami')
print('\nOh my god,宇宙无敌第一好吃的烟熏牛肉卖完了')
print ('\n店里只剩下以下几种三明治了:')
for finished_sandwiche in finished_sandwiches:
print (finished_sandwiche.title())
《Python编程从入门到实践》7.9练习题
最新推荐文章于 2020-11-21 10:44:20 发布