Mia is baking cookies for a school event. She bought 4 bags of flour for $2 each, 2 cartons of eggs for $3 each, and 5 packs of chocolate chips for $4 each. She also had a $5 discount coupon for her purchase. Write a Python program to calculate the total money Mia spent after using the coupon.
- Start by asking for Mia’s name and store it in a variable called
name
. - Define variables for the costs:
- Store the cost per bag of flour in a variable called
flour_bag_cost
and set it to 2. - Store the number of bags of flour in a variable called
num_flour_bags
and set it to 4. - Store the cost per carton of eggs in a variable called
egg_carton_cost
and set it to 3. - Store the number of cartons of eggs in a variable called
num_egg_cartons
and set it to 2. - Store the cost per pack of chocolate chips in a variable called
chocolate_chip_pack_cost
and set it to 4. - Store the number of packs of chocolate chips in a variable called
num_chocolate_chip_packs
and set it to 5. - Store the discount amount in a variable called
discount
and set it to 5.
- Store the cost per bag of flour in a variable called
- Calculate the total cost of the flour bags by multiplying
flour_bag_cost
bynum_flour_bags
. - Calculate the total cost of the egg cartons by multiplying
egg_carton_cost
bynum_egg_cartons
. - Calculate the total cost of the chocolate chip packs by multiplying
chocolate_chip_pack_cost
bynum_chocolate_chip_packs
. - Calculate the total amount before applying the discount by adding the total flour cost, total egg cost, and total chocolate chip cost.
- Subtract the discount amount from the total amount before applying the discount to get the final amount spent.
- Store the final amount in a variable called
total_spent
. - Print a message that includes Mia’s name and the total amount spent after using the discount in a friendly sentence, like this: “Hi [name]! After using your discount, you spent a total of $[total_spent] on your baking supplies.”