Question 21: Operators

Noah is organizing a charity event. He spent $400 on venue rental, $250 on food, $180 on decorations, $220 on entertainment, and $150 on promotional materials.

Write a Python program to calculate the total money Noah spent on all the items.

  1. Start by asking for Noah’s name and store it in a variable called name.
  2. Define variables for the costs of the venue rental, food, decorations, entertainment, and promotional materials:
    • Store the cost of venue rental in a variable called venue_cost and set it to 400.
    • Store the cost of food in a variable called food_cost and set it to 250.
    • Store the cost of decorations in a variable called decorations_cost and set it to 180.
    • Store the cost of entertainment in a variable called entertainment_cost and set it to 220.
    • Store the cost of promotional materials in a variable called promo_cost and set it to 150.
  3. Calculate the total amount spent by adding all the item costs.
  4. Store the total amount in a variable called total_cost.
  5. Print a message that includes Noah’s name and the total amount spent in a friendly sentence, like this:
    “Hi [name]! You spent a total of $[total_cost] on your charity event preparations.”
Write what you are looking for, and press enter to begin your search!