Question 22: Operators Birthday
🎈 Birthday Party Treats
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.
-
Store Mishael name 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.”