Question 9: Input

Write a Python program to determine the net number of toy cars a child has after receiving them on multiple occasions and losing some over time.

  1. Start by asking for the child’s name and store it in a variable called name.
  2. Ask how many toy cars they received each month for three months, storing these values in variables called month1_cars, month2_cars, and month3_cars (as integers).
  3. Calculate the total number of toy cars they received by adding month1_cars, month2_cars, and month3_cars.
  4. Ask how many toy cars they lost each week for a month, storing this value in a variable called weekly_lost_cars (as an integer).
  5. Calculate the total number of toy cars lost by multiplying weekly_lost_cars by 4 (assuming 4 weeks in a month).
  6. Subtract the total number of cars lost from the total number of cars received to get the net number of cars.
  7. Store the net number of cars in a variable called net_cars.
  8. Print a message that includes the child’s name and the net number of toy cars in a friendly sentence, like this: “Hi [name]! You have a net total of [net_cars] toy cars after accounting for the ones you lost over the weeks.”
Write what you are looking for, and press enter to begin your search!