I am completely new to python, i'm learning it online through a course and got stuck in an exercise. I can't figure out the problem at all, i feel like my solution to the exercise is ok but whenever i choose the option of adding cheese to my "S" pizza, it does not add it in the final price even though i've written it in my code, can anyone explain me whats the problem with my solution?
I don't know if I've explained correctly but I've added a screenshot to make it easier to understand.
Any help is deeply appreciated ;-; i'm a noob and i'm sure it would be easy for pros to explain such an easy exercise's problem, halp. I can't figure out the problem.
This is the result i get when i try to add the cheese to the S pizza, the other sizes of the pizza work well, i dont understand whats the problem at all..
Terminal:-
Welcome to Python Pizza Deliveries!
What size pizza do you want? S, M, or L *S*
Do you want pepperoni? Y or N *N*
Do you want extra cheese? Y or N *Y*
Your final bill is: $15.
I've attached image so that its easier for you guys to understand.
Here's the code:-
print("Welcome to Python Pizza Deliveries!")
size = input("What size pizza do you want? S, M, or L ")
add_pepperoni = input("Do you want pepperoni? Y or N ")
extra_cheese = input("Do you want extra cheese? Y or N ")
price = 0
if size == "L":
price = 25
if add_pepperoni == "Y":
price += 3
if extra_cheese == "Y":
price += 1
if size == "M":
price = 20
if add_pepperoni == "Y":
price += 3
if extra_cheese == "Y":
price += 1
if size == "S":
price = 15
if add_pepperoni == "Y":
price += 2
if extra_cheese == "Y":
price += 1
print(f"Your final bill is: ${price}.")