Question 14: Multiple Ifs

John has $400 saved up and decides to spend it on different activities and items. After his expenses, he plans to divide the remaining money equally among four investment options. Write a Python program to calculate how much money John has left after his expenses and how much each investment will receive. Use multiple if conditions to tell him if he has enough money to invest or if he spent all his money.

  1. Start by defining a variable for the initial savings and set it to $400.
  2. Ask John how much he spent on a concert ticket and store it in a variable called concert_cost (as an integer).
  3. Ask how much he spent on a dinner and store it in a variable called dinner_cost (as an integer).
  4. Ask how much he spent on shopping and store it in a variable called shopping_cost (as an integer).
  5. Ask how much he spent on transportation and store it in a variable called transportation_cost (as an integer).
  6. Ask how much he 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. Use multiple if conditions to check:
    • If the amount left is greater than zero, calculate the amount each investment will receive by dividing the amount left by 4.
    • If the amount left is zero, notify John that he has no money left.
    • If the amount left is negative, notify John that he spent more than his savings.
  10. Print a message that tells him how much he has left and whether he can invest the money or if he spent all his money.
Write what you are looking for, and press enter to begin your search!