Cake Sale

cakesaleYou are organising a cake sale and want to predict how much money you will raise.

During this cake sale you will be selling the following three types of cakes:
cakesale-cakes

Input


You decide to write a python script that asks the user three questions:

  • How many cupcakes do you plan to sell?
  • How many macarons do you plan to sell?
  • How many cheesecake do you plan to sell?

Process


The python script will then calculate the total money raised using the three user inputs and the prices as follows:

  • Cupcakes: 40p per cupcake,
  • macarons: 50p per macaron,
  • cheesecake: 70p per slice.

Output


The script will finally display this information (total money raised) to the end-user.

Complete the code


Complete your code in the trinket below.

Testing


Once your code is done, complete the following tests to check that your code is working as it should:

Test # Input Values Expected Output Actual Output
#1 Cupcakes: 10
Macarons: 10
Cheesecake: 5
£12.50
#2 Cupcakes: 20
Macarons: 30
Cheesecake: 20
£37
#3 Cupcakes: 40
Macarons: 10
Cheesecake: 10
£28
#4 Cupcakes: 20
Macarons: 20
Cheesecake: 20
£32
#5 Cupcakes: 0
Macarons: 0
Cheesecake: 0
£0

ingredients

Video Tutorial


Extension Task


It did cost £12 pounds to buy all the ingredients to bake all the cakes.

Adapt your program to calculate and display the profit knowing that:


profit = money raised – expenses

Then use an If statement to check whether you have made a profit (profit > 0) or a loss (profit < 0) or whether you did break even (profit == 0).

Share Button
Posted in Computer Science, Python - Beginner, Python Challenges Tagged with: , ,

Our Latest Book