Mishael is preparing goody bags for his birthday party. Each goody bag will have 3 candies, 2 balloons, and 1 toy. He is making 10 goody bags.
Write a Python program to calculate the total number of items Liam will need.
Start by asking for his name and store it in a variable called name
.
Store the number of goody bags in a variable called bags
and set it to 10.
Store the number of candies per bag in a variable called candies_per_bag
and set it to 3.
Store the number of balloons per bag in a variable called balloons_per_bag
and set it to 2.
Store the number of toys per bag in a variable called toys_per_bag
and set it to 1.
Multiply each item by the number of bags to get the total items:
Total candies = candies_per_bag * bags
Total balloons = balloons_per_bag * bags
Total toys = toys_per_bag * bags
Add all the totals and store in a variable called total_items
.
Print a friendly message like this:
“Hi [name]! You need a total of [total_items] items to fill 10 goody bags.”
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!