Completed Exercise 7-9 No Pastrami
This commit is contained in:
parent
10493c58d4
commit
7834473b85
18
Chapter_07/7-09_no_pastrami.py
Normal file
18
Chapter_07/7-09_no_pastrami.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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}")
|
||||||
Loading…
x
Reference in New Issue
Block a user