Build Your Own Pizza Price Calculator

Welcome to this beginner-friendly Python challenge! In this task, you will create a simple pizza ordering system that calculates the total cost based on a customer’s choices. This is a great way to practise input handling, selection (if statements), and basic arithmetic in Python.

The Challenge

For this challenge, you will create a program that allows a customer to build their own pizza by choosing:

  • Pizza size (Small, Medium, Large)
  • Base type (Classic crust, thin crust or deep pan)
  • Number of toppings
  • Eat in or takeaway

Your program will then calculate and display the total price.

Finally, the user will be able to enter a discount code. If this discount code is correct they will receive a 20% discount on the price of their pizza!

To complete this challenge, you willl need to use:

  • input() statements to collect user choices
  • if / elif / else statements
  • Variables to store prices
  • Basic maths operations

Pizza Options & Costs

The following poster informs the customer of the process of making their own pizza and explains how the cost is calculated.

Python Code

We have started the code for you. Your job is to complete this code to let the user enter all their desired options for their pizza and to adjust the price of the pizza accordingly.

Extension Task: Discount Code

After entering all their options the customer should be given the opportunity to enter a discount code if they want to. If the user enter the code “P1ZZ4”, they should benefit from a 20% discount on the total price of their pizza!

Test Plan

Once your code is complete, test it using the following test plan to make sure all your calculations are correct!

Test # Input Values Expected Output Pass / Fail
#1 Pizza Size: Small (S)
Base: Deep
Number of Toppings 3
Eat in? Yes
Discount Code: N/A
Pizza Price: £14.50
#2 Pizza Size: Large (L)
Base: Thin
Number of Toppings 4
Eat in? No
Discount Code: FREEPIZZA
Pizza Price: £17.00
#3 Pizza Size: Medium (M)
Base: Classic
Number of Toppings 5
Eat in? Yes
Discount Code: P1ZZ4
Pizza Price: £14.00
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!