Question 19: If Else

A group of friends decided to spend a weekend organizing a community sports event. Each friend had $200 saved up, but they also earned extra money by selling tickets and refreshments at the event. Write a Python program to calculate how much each friend has left after organizing the event and earning from ticket sales.

Start by defining the initial amount saved as saved_amount and set it to 200.

  1. Ask each friend how much they spent renting the sports venue and store it in venue_rental.
  2. Ask how much they spent on sports equipment for the event and store it in equipment_cost.
  3. Ask how much they spent on prizes for the winners and store it in prizes_cost.
  4. Ask how much they spent on refreshments for the players and spectators and store it in refreshments_cost.
  5. Ask how much they earned from selling event tickets and store it in ticket_sales.
  6. Ask how much they earned from selling refreshments during the event and store it in refreshments_sales.
  • Calculate the total amount spent by adding up venue_rental, equipment_cost, prizes_cost, and refreshments_cost.
  • Calculate the total amount earned by adding ticket_sales and refreshments_sales.
  • Subtract the total amount spent from the sum of saved_amount and the total earnings to find the remaining balance.

Use an if condition to check:

  • If the remaining balance is positive, print how much money each friend has left.
  • If the remaining balance is zero or negative, print that they spent more than they saved.

Additionally, if any of the spending exceeds half of the saved_amount, print a warning message indicating they are spending too much on a single activity.

Write what you are looking for, and press enter to begin your search!