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.”
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!