Question 2: Operators

Ella is buying supplies for her art project. She bought 5 packs of colored pencils for $4 each, a sketchbook for $12, and 3 packs of markers for $7 each. She also used a $10 coupon for her purchase. Write a Python program to calculate the total money Ella spent after using the coupon.

  • Start by asking for Ella’s name and store it in a variable called name.
  • Define variables for the costs:
    • Store the cost per pack of colored pencils in a variable called pencil_pack_cost and set it to 4.
    • Store the number of pencil packs in a variable called num_pencil_packs and set it to 5.
    • Store the cost of the sketchbook in a variable called sketchbook_cost and set it to 12.
    • Store the cost per pack of markers in a variable called marker_pack_cost and set it to 7.
    • Store the number of marker packs in a variable called num_marker_packs and set it to 3.
    • Store the coupon amount in a variable called coupon and set it to 10.
  • Calculate the total cost of the colored pencil packs by multiplying pencil_pack_cost by num_pencil_packs.
  • Calculate the total cost of the marker packs by multiplying marker_pack_cost by num_marker_packs.
  • Calculate the total amount before applying the coupon by adding the total colored pencil cost, total marker cost, and sketchbook_cost.
  • Subtract the coupon amount from the total amount before applying the coupon to get the final amount spent.
  • Store the final amount in a variable called total_spent.
  • Print a message that includes Ella’s name and the total amount spent after using the coupon in a friendly sentence, like this: “Hi [name]! After using your coupon, you spent a total of $[total_spent] on your art supplies.”
Write what you are looking for, and press enter to begin your search!