Question 9: If Else

A boy saved $200. Write a Python program to find out how much money he has left after spending on various activities and check if he has any money left or if he spent more than he saved.

  • Start by defining the initial amount saved as saved_amount and set it to 200.
  • Ask the boy how much he used to watch a movie and store it in a variable called movie_cost (as an integer).
  • Ask the boy how much he spent on popcorn and store it in a variable called popcorn_cost (as an integer).
  • Ask the boy how much he spent on ice cream and store it in a variable called ice_cream_cost (as an integer).
  • Ask the boy how much he spent on transport and store it in a variable called transport_cost (as an integer).
  • Ask the boy how much money he lost and store it in a variable called lost_money (as an integer).
  • Calculate the total amount spent by adding movie_cost, popcorn_cost, ice_cream_cost, transport_cost, and lost_money.
  • Subtract the total amount spent from saved_amount to get the remaining amount.
  • Use an if condition to check if the remaining amount is still positive or if he spent more than he saved.
  • Print a message that tells him how much money he has left and whether he has any savings left or if he spent more than he saved.
Write what you are looking for, and press enter to begin your search!