-
Notifications
You must be signed in to change notification settings - Fork 0
/
IfStatementList.py
33 lines (25 loc) · 1.02 KB
/
IfStatementList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#IfStatementList
requested_toppings = ['mushrooms','green peppers','extra cheese']
for requested_topping in requested_toppings:
if requested_topping == 'green peppers':
print("Sorry, we are out of green peppers now.")
else:
print(f"Adding {requested_topping}.")
print("finished making your pizza")
# Check list is not empty:
requested_toppings = []
if requested_toppings:
for requested_topping in requested_toppings:
print(f"Adding {requested_topping}")
print("finished making pizza")
else:
print("Are you sure you want a plain pizza!")
#Check requested toppings list available in available list
requested_toppings = ['mushrooms','french fries','extra cheese']
available_toppings = ['mushrooms','olives','green peppers','pepperoni','pineapple','extra cheese']
for requested_topping in requested_toppings:
if requested_topping in available_toppings:
print(f"Adding requested topping {requested_topping}")
else:
print(f"Sorry, we don't have requested topping {requested_topping}")
print("finished making your pizza")