Question 13: Operators

Mia bought crafting materials for her art project. She bought 10 sheets of colored paper for $0.50 each, 5 packs of markers for $3 each, and 2 bottles of glue for $1.50 each. Write a Python program to calculate the total amount Mia spent on crafting materials.

  • Start by asking for Mia’s name and store it in a variable called name.
  • Define variables for the number of each type of crafting material and their respective prices:
    • Store the number of colored paper sheets in a variable called num_papers and set it to 10.
    • Store the price of each colored paper sheet in a variable called paper_price and set it to 0.50.
    • Store the number of marker packs in a variable called num_markers and set it to 5.
    • Store the price of each marker pack in a variable called marker_price and set it to 3.
    • Store the number of glue bottles in a variable called num_glues and set it to 2.
    • Store the price of each glue bottle in a variable called glue_price and set it to 1.50.
  • Calculate the total cost of colored paper by multiplying num_papers by paper_price.
  • Calculate the total cost of marker packs by multiplying num_markers by marker_price.
  • Calculate the total cost of glue bottles by multiplying num_glues by glue_price.
  • Calculate the total amount spent by adding the total paper cost, total marker cost, and total glue cost.
  • Print a message that includes Mia’s name and the total amount spent in a friendly sentence.
Write what you are looking for, and press enter to begin your search!