Question 18: Operators

Liam is organizing a graduation party. He bought chairs for $120, food for $250, drinks for $80, and a sound system for $150.

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

  1. Start by saving Liam’s name and store it in a variable called name.
  2. Define variables for the costs of the chairs, food, drinks, and sound system:
    • Store the cost of chairs in a variable called chairs_cost and set it to 120.
    • Store the cost of food in a variable called food_cost and set it to 250.
    • Store the cost of drinks in a variable called drinks_cost and set it to 80.
    • Store the cost of the sound system in a variable called sound_system_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 Liam’s name and the total amount spent in a friendly sentence, like this:
    “Hi [name]! You spent a total of $[total_cost] on your graduation party preparations.”
Write what you are looking for, and press enter to begin your search!