Write a Python program to find out how many pencils a child has in total.
Start by asking for the child’s name and store it in a variable called name
.
Ask how many boxes of pencils they have and store it in a variable called boxes
(as an integer).
Ask how many pencils are in each box and store it in a variable called pencils_per_box
(as an integer).
Multiply boxes
by pencils_per_box
and store the result in a variable called total_pencils
.
Print a friendly message that includes the child’s name and the total number of pencils they have, like this:
“Hi [name]! You have a total of [total_pencils] pencils.”
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!