Michael received a gift of $200 for his birthday. He decided to use this money to buy different items and also to split some of the money for a future investment. First, he bought a gadget. Then, he purchased some clothes. After that, he treated himself to a nice meal. He also decided to donate some money to charity. Finally, he decided to split the remaining money into equal parts for a future investment. Write a Python program to calculate how much money Michael has left after his expenses and how much money each investment part will get. Use an if condition to tell him if he can still invest or if he spent all his money.
- Start by defining a variable for the initial gift amount and set it to $200.
- Ask Michael how much he used to buy a gadget and store it in a variable called
gadget_cost
(as an integer). - Ask how much he spent on clothes and store it in a variable called
clothes_cost
(as an integer). - Ask how much he spent on a meal and store it in a variable called
meal_cost
(as an integer). - Ask how much he donated to charity and store it in a variable called
charity_donation
(as an integer). - Calculate the total expenses by adding
gadget_cost
,clothes_cost
,meal_cost
, andcharity_donation
. - Calculate the amount left by subtracting the total expenses from the initial gift amount.
- Ask Michael how many parts he wants to split the remaining money into and store it in a variable called
num_parts
(as an integer). - Calculate the amount per part by dividing the amount left by
num_parts
if the amount left is greater than zero. - Use an if condition to check if there is still money left to invest or if he spent all his money.
- Print a message that tells him how much he has left and whether he can invest the money into parts or if he spent all his money.