Completed Exercise 7-4 Pizza Toppings
This commit is contained in:
parent
8babebed7c
commit
c5e546859c
18
Chapter_07/7-04_pizza_toppings.py
Normal file
18
Chapter_07/7-04_pizza_toppings.py
Normal file
@ -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}')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user