Task 4.3: Initialise Active Foods List
- Create a new empty list called
active_foods
, and this list will store all the Food objects you create. - Write a
for
loop that goes through every item in yourfoods
dictionary. In each loop, you will create a new Food object.
💡 Hint
- Use
.items()
to loop through both the key and value. - The key will be the name of the food.
- The value will be a list containing:
[image path, x position, y position]
3. Create a New Food Object for Each Item
💡 Hint
key
-> namevalue[0]
-> image pathvalue[1]
-> x positionvalue[2]
-> y position
🚩 Checkpoint
- An empty
active_foods
list is created. - A loop that:
- Goes through every food in your dictionary.
- Creates a Food object.
- Adds it into the
active_foods
list.