Question 22: Operators

Write a Python program to find out how many candies a child has left after sharing some with friends.

  • Start by asking for the child’s name and store it in a variable called name.

  • Ask how many candies they originally had and store it in a variable called original_candies (as an integer).

  • Ask how many candies they shared with their friends and store it in a variable called shared_candies (as an integer).

  • Calculate how many candies they have left by subtracting shared_candies from original_candies and store it in a variable called candies_left.

  • Print a friendly message that includes the child’s name and the number of candies they have left, like this:

    “Hi [name]! After sharing, you have [candies_left] candies left.”

Write what you are looking for, and press enter to begin your search!