I am creating a python pizza app (yes I know there is a ton of them) but, I am coming across a scenario that I need help understanding.
price = 0
toppings = {
'mushrooms': .5,
'onions': .5,
'pepperoni': 1,
'extra-cheese':1
}
pizzaSize = {
'small': 8,
'medium': 10,
'large': 12,
'x-large': 14
}
order1 = input("Welcome to the pizza store what size pizza can we get for you (small, medium, large, or x-large): " )
print(order1)
if order1 == pizzaSize.keys():
print(order1)
I understand that this code will not work when it comes to the if order1
part. However, I am interested in understanding how I could take the input and match it with a key of the dict pizzaSize
.
Here is why I want to do that. I want to take user input and check and see if it is contained inside the pizzaSize
dict.
If the string is contained there, I want to add the value of that key that matched to the price
variable set at the top. Thank you all!