Python Development Course
Chapter 3
>
Level 4
Objective
Take basket of eggs and store the eggs in containers before addressing how many eggs you stored.
Constants are similar to variables except that they have a pre-assigned value that can not be changed. In this exercise, you will be using a constant named egg_basket which has an unknown value representing the number of eggs in the basket.
Create two variables for each container named: bag1, bag2 and store half of the eggs in each bag by using operators, like this: bag1 = egg_basket/2
Head for the dark X marks in front of containers and use the place() function to put the bags in each container like this: player.place(bag1) .
Afterwards head for the light X marks in front of the tables and use the speak() function to express how many eggs you have.
On the first light X mark express how many eggs you have total: player.speak("there are %d eggs" % (egg_basket)) . On the next light X mark express how many eggs are in each container, like this: player.speak("there are %d eggs in bag 1 and %d in bag 2" % (bag1, bag2))