From c5e546859c026b6f0c399196ec5f2649e4e643f3 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Mon, 3 Feb 2025 20:23:14 -0500 Subject: [PATCH] Completed Exercise 7-4 Pizza Toppings --- Chapter_07/7-04_pizza_toppings.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Chapter_07/7-04_pizza_toppings.py diff --git a/Chapter_07/7-04_pizza_toppings.py b/Chapter_07/7-04_pizza_toppings.py new file mode 100644 index 0000000..a7c4019 --- /dev/null +++ b/Chapter_07/7-04_pizza_toppings.py @@ -0,0 +1,18 @@ +# Exercise 7-4 Pizza Toppings +# Learning Objective: Create a simple while loop. + +toppings = [] +prompt = 'Enter your toppings one by one, when done type "quit": \n' +print(prompt) +new_topping = "" +while new_topping != 'quit': + new_topping = input() + if new_topping.lower() == 'quit': + break + toppings.append(new_topping) + print(f"\n\tAdding {new_topping} to your pizza... \n") + +print(f"\n\nYour pizza selection is as follows:") +for topping in toppings[:]: + print(f'\t{topping}') + \ No newline at end of file