python-crash-course/Chapter_07/7-09_no_pastrami.py
2025-02-06 08:17:19 -05:00

18 lines
645 B
Python

# Exercise 7-9 No Pastrami
# Learning Objective: USe a loop to edit a list. Print list.
print('Sorry the deli has run out of pastrami...')
sandwich_orders = ['Ham and Swiss', 'Pastrami', 'Bologna and Cheese', 'Pastrami', 'Italian Combo', 'Chicken Parm', 'Pastrami']
finished_sandwiches = []
while sandwich_orders:
while 'Pastrami' in sandwich_orders:
sandwich_orders.remove('Pastrami')
sandwich = sandwich_orders.pop()
print(f"I made your {sandwich}")
finished_sandwiches.append(sandwich)
print(f"\nSandwiches made: ")
for sandwiches in finished_sandwiches:
print(f"{sandwiches}")