# Python exercise: Pizza Cost Calculator

Today’s exercise is to work out a cost calculator for a pizza order. This exercise uses if, elif, else, and changing the cost variable as items are added to the order.

My initial take on the exercise gave me the result I was looking for:

```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 ")```
```if size == "S":
bill = 15
bill += 2
if extra_cheese == "Y":
bill += 1
else: print(f"Your final bill is: \${bill}.")

if size == "M":
bill = 20
bill += 3
if extra_cheese == "Y":
bill += 1
else: print(f"Your final bill is: \${bill}.")

if size == "L":
bill = 25
bill += 3
if extra_cheese == "Y":
bill += 1
else: print(f"Your final bill is: \${bill}.")```

But, after viewing the instructor’s version (see below), I saw that my code was a bit more inefficient, and I also could’ve made better use of “else,” instead of spelling out each separate option. My solution was 27 lines, vs. their 18 lines.

```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 ")

bill = 0
if size == "S":
bill += 15
if size == "M":
bill += 20
if size == "L":
bill += 25