You need may use an .get()
to get the corresponding value from the dict, if it doesn’t exist you’ll a None
order1 = input("Welcome to the pizza store what size pizza can we get for you (small, medium, large, or x-large): " )
size_price = pizzaSize.get(order1)
if size_price is not None:
price += size_price
else:
print(f"Sorry the size '{order1}' doesn't exist")
exit(1)
5
solved Matching dict keys with user input in python [duplicate]