Question 11: Input

Write a Python program to find out how many fruits a child has collected.

  1. Start by asking for the child’s name and store it in a variable called name.
  2. Ask how many apples they have collected and store it in a variable called apples (as an integer).
  3. Ask how many bananas they have collected and store it in a variable called bananas (as an integer).
  4. Ask how many oranges they have collected and store it in a variable called oranges (as an integer).
  5. Calculate the total number of fruits by adding apples, bananas, and oranges and store it in a variable called total_fruits.
  6. Print a friendly message that includes the child’s name and the total number of fruits they have collected, like this:
    “Hi [name]! You have collected a total of [total_fruits] fruits.”
Write what you are looking for, and press enter to begin your search!