What I wrote
if membership_card in [123456, 5678901, 234567, 345678, 456789, 901234]: print('Your membership card number have been confirm \nWith this you will have 10% discount for your every ' 'purchased') print('Ok, then here are the menu\n' + menu) order = input('What do you like to order?\n') Quantity = input("How many would you like?\n") good_to_go = True while not good_to_go: if order == 'Americano': price = 4 good_to_go = True
elif order == 'Latte':
price = 7
good_to_go = True
whipping_cream_good_to_go = False
while not whipping_cream_good_to_go:
add_on = input('Do u want whipping cream\n')
if add_on == 'Yes':
price = 11
whipping_cream_good_to_go = True
if not whipping_cream_good_to_go:
print('Invalid syntax')
elif order == 'Cappuccino':
price = 9
good_to_go = True
elif order == 'Espresso':
price = 10
good_to_go = True
elif order == 'Black Coffe':
price = 3
good_to_go = True
total = price * int(Quantity)
print('and the total of it is\n' + str(total))
What i Got
total = price * int(Quantity)
^^^^^
NameError: name 'price' is not defined. Did you mean: 'print'?
a solution to my python problem