#python编程从入门到实践练习7-9 五香烟熏牛肉买完了

#按照要求创建一个包含各种三明治名为sandwich_orders的列表
sandwich_orders = ['Black Forest Ham','pastrami',\
 'Cold Cut Combo','Italian B.M.T.','pastrami',\
 'Oven Roasted Chicken','Roast Beef','pastrami',\
 'Spicy Italian','Steak & Cheese','Subway Club',\
 'pastrami','Classic Tuna','Turkey Breast',\
 'Veggie Delite']
#在创建一个名为finished_sandwiches的空列表
finished_sandwiches = []
# 五香烟熏牛肉买完了
print(f'\nThe pastrami is sell up!')
#遍历列表sandwich_orders,并删除里面的五香烟熏牛肉三明治
while 'pastrami' in sandwich_orders:
    sandwich_orders.remove('pastrami')
print(sandwich_orders)
#遍历列表sandwich_orders,并对其中每种三明治都打印一条消息
while sandwich_orders:
    current_orders = sandwich_orders.pop()
    print(f'\nI made your {current_orders}!')
    finished_sandwiches.append(current_orders)
#对已经添加进finished_sandwiches列表的元素进行倒序打印!使其
#与sandwich_orders列表元素排列一致
finished_sandwiches.reverse()
print(f'\n---All Sandwiches are finished--- ')
for finished_sandwich in finished_sandwiches:
    print(finished_sandwich.title())

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yyyxx1990

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值