Question 12: If Else

Sophie has $300 saved up and decides to spend it on different activities and items. After her expenses, she plans to divide the remaining money equally among her three friends. Write a Python program to calculate how much money Sophie has left after her expenses and how much each friend will receive. Use an if condition to tell her if she has enough money to give to her friends or if she spent all her money.

  1. Start by defining a variable for the initial savings and set it to $300.
  2. Ask Sophie how much she spent on a concert ticket and store it in a variable called concert_cost (as an integer).
  3. Ask how much she spent on dinner and store it in a variable called dinner_cost (as an integer).
  4. Ask how much she spent on shopping and store it in a variable called shopping_cost (as an integer).
  5. Ask how much she spent on transportation and store it in a variable called transportation_cost (as an integer).
  6. Ask how much she spent on a movie and store it in a variable called movie_cost (as an integer).
  7. Calculate the total expenses by adding concert_cost, dinner_cost, shopping_cost, transportation_cost, and movie_cost.
  8. Calculate the amount left by subtracting the total expenses from the initial savings.
  9. Calculate the amount each friend will receive by dividing the amount left by 3 if the amount left is greater than zero.
  10. Use an if condition to check if there is still money left to give to her friends or if she spent all her money.
  11. Print a message that tells her how much she has left and whether she can give money to her friends or if she spent all her money.
Write what you are looking for, and press enter to begin your search!