Question 4: If Else Elif

Write a Python program to find out if a child has met their book collection goal.

  1. Start by asking for the child’s name and store it in a variable called name.
  2. Ask how many adventure books they have and store it in a variable called adventure_books (as an integer).
  3. Ask how many science books they have and store it in a variable called science_books (as an integer).
  4. Ask how many comic books they have and store it in a variable called comic_books (as an integer).
  5. Calculate the total number of books by adding adventure_books, science_books, and comic_books, and store it in a variable called total_books.
  6. Use an if-else condition to check:
    • If the total number of books is 15 or more, print:
      “Fantastic, [name]! You have [total_books] books, reaching your collection goal!”
    • Otherwise, print:
      “Keep it up, [name]! You have [total_books] books. Collect a few more to reach your goal!”
Write what you are looking for, and press enter to begin your search!