Contact Us:

670 Lafayette Ave, Brooklyn,
NY 11216

+1 800 966 4564
+1 800 9667 4558

Congratulations, you’ve got a job at Python Pizza.
Your first job is to build an automatic pizza order program.
Based on a user’s order, work out their final bill.
Small Pizza: $15
Medium Pizza: $20
Large Pizza: $25
Pepperoni for Small Pizza: +$2
Pepperoni for Medium or Large Pizza: +$3
Extra cheese for any size pizza: + $1

Example Input
size = “L”
add_pepperoni = “Y”
extra_cheese = “N”
Example Output
Your final bill is: $28.

print("Welcome to Python Pizza!")
price = 0
# Inouts
pizza = input("What Pizza You want?\nSmall = $15\nMedium = $20\nLarge = $25\nSlect One: S M L\n")
print("")
if pizza == "S":
  print("Small Pizza Selected!")
  price = 15
  pizzaPepMe = "Small Pizza: +$2"
elif pizza == "M":
  print("Medium Pizza Selected!")
  price = 20
  pizzaPepMe = "Medium or Large Pizza: +$3"
elif pizza == "L":
  print("Large Pizza Selected!")
  price = 25
  pizzaPepMe = "Medium or Large Pizza: +$3"
else:
  print("No Pizza Selected!")
print("")
if pizza!="":
  print(f"Pepperoni for {pizzaPepMe}")
  pepperIn = input("Do You Want Pepperoni?\nY N\n")
  print(f"Extra cheese for any size pizza: + $1")
  cheeseIn = input("Do You Want Extra Cheese?\nY N\n")
  
  if pepperIn == "Y":
    if pizza == "S":
      price += 2
      pepperoni = "Pepperoni and "
    elif pizza == "M" or pizza == "L":
      price += 3
      pepperoni = "Pepperoni and "
  else:
    pepperoni = "No Pepperoni"
  
  if cheeseIn == "Y":
    price += 1
    cheese = "Extra Cheese"
  else:
    cheese = "No Extra Cheese"
print(f"\nYour final bill is: ${price}.\n With {pepperoni} {cheese}")
0 0 votes
Article Rating

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x