Question 12: Operators

Ava baked and sold cupcakes. She made 40 cupcakes and sold each for $2.50. The cost to make each cupcake was $1.25. Write a Python program to calculate Ava’s total revenue and profit.

  • Start by asking for Ava’s name and store it in a variable called name.
  • Define variables for the number of cupcakes made and sold, their selling price, and their cost price:
    • Store the number of cupcakes in a variable called num_cupcakes and set it to 40.
    • Store the selling price of each cupcake in a variable called selling_price and set it to 2.50.
    • Store the cost price of each cupcake in a variable called cost_price and set it to 1.25.
  • Calculate the total revenue by multiplying the number of cupcakes by the selling price.
  • Calculate the total cost by multiplying the number of cupcakes by the cost price.
  • Calculate the profit by subtracting the total cost from the total revenue.
  • Print a message that includes Ava’s name, the total revenue, and the profit in a friendly sentence.
Write what you are looking for, and press enter to begin your search!