From 7834473b855d89f229cab991be83ca396b422035 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Thu, 6 Feb 2025 08:17:19 -0500 Subject: [PATCH] Completed Exercise 7-9 No Pastrami --- Chapter_07/7-09_no_pastrami.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Chapter_07/7-09_no_pastrami.py diff --git a/Chapter_07/7-09_no_pastrami.py b/Chapter_07/7-09_no_pastrami.py new file mode 100644 index 0000000..7b696bb --- /dev/null +++ b/Chapter_07/7-09_no_pastrami.py @@ -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}") \ No newline at end of file