lundi 17 mai 2021

if-else syntax error (Pizza delivery problem) [closed]

print('Welcome to Python Pizza Deliveries!')
size = input('What size pizza do you want? S, M, or L? ').lower()
add_pepperoni = input('Do you want to add perperoni? Y or N? ').lower()
extra_cheese = input('Do you want to add extra cheese? Y or N? ').lower()
bill = 0
if size == 's':
    bill = 15 
    if add_pepperoni == 'y':
        bill += 2
elif size == 'm':
    bill = 20
    if add_pepperoni == 'y':
        bill += 3
elif size == 'l':
    bill = 25
    if add_pepperoni =='y':
        bill += 3

if extra_cheese == 'y':
    bill += 1
print(f'Your total bill is ${bill}.')
else :
    print('Invalid Response.')   

I don't know why I am getting a syntax error at the last else statement. I wanted to add an Invalid response as an option but where I am getting it wrong? I am getting this

File "<ipython-input-202-1b45bbcb6bb4>", line 22
    else :
    ^
SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire