Lesson 6 of 6
Final project: the complete adventure
The grand finale! Your hero will chain two boss battles using everything you know: dictionaries, functions, loops and conditions.
Finish this project and you earn the Season 3 legend badge. 👑
for monster in monsters:
hp = monster["hp"]
while hp > 0:
...🎯 Your mission
Your hero (power = 5) faces monsters = [{"name": "Golem", "hp": 8}, {"name": "Dragon", "hp": 15}]. For each monster: fight it with a while loop (max(0, hp - power)) counting every hit in total_rounds (starting at 0). When both monsters are defeated, create victory = True and print total_rounds.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →