Finding Treasure
Win the game.
Finding Treasure is a free Coding for Kids lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Treasure Time! 💎
Ahoy, explorer! 🏴☠️ This is the moment we've waited for... FINDING THE TREASURE and WINNING the game! 💎🎉
Let's build the happy ending! 🌟
print("Let's find the treasure! 💎")The Final Door 🚪
The player reaches the final door. Behind it... maybe the treasure! 🚪💎
print("You reach a golden door. 🚪✨")
print("Something shiny is behind it... 💎")Win with if 🏆
If the player makes the right choice, they WIN! 🏆
key = "golden key"
if key == "golden key":
print("The door opens! 🎉")
print("TREASURE FOUND! 💎🪙👑")A Big Celebration 🎊
Winning deserves a BIG celebration message! 🎊🎉
print("🎉🎉🎉🎉🎉")
print("YOU WIN! 🏆")
print("🎉🎉🎉🎉🎉")Count the Treasure 🪙
How much gold did they collect? Let's add it up! 🪙
coins = 50
coins = coins + 100
print("You found 100 gold coins! 🪙")
print("Total treasure:", coins, "coins! 💰")A Winning Trophy 🏆
Let's draw a trophy with ASCII art to reward the winner! 🏆
print(" ___ ")
print("|WIN|")
print(" \\_/ ")
print(" | ")
print(" === ")Check the Player's Stats 📊
Did the player survive with enough health to win? Let's check! 📊
health = 40
if health > 0:
print("You made it alive! 💪")
print("Treasure is YOURS! 💎")A Personal Victory 😊
Use the player's name in the win message to make it special! 😊
name = "Sam"
print(f"Congratulations, {name}! 🎉")
print(f"{name} is the Treasure Champion! 👑")A Win Function 🛠️
Put the whole victory into a function you can call! 🛠️
def win(name):
print(f"{name} found the treasure! 💎")
print("YOU WIN! 🏆")
win("Alex")Choice Leads to Win 🌳
Let's connect a real choice to the victory! Pick the right path to win! 🌳
choice = "open chest"
if choice == "open chest":
print("GOLD everywhere! 🪙🪙🪙")
print("YOU WIN! 🏆")
else:
print("You walk away empty-handed. 😢")Treasure Hunter! 🏆
You built a WINNING ending! 🎉
- Use
ifto trigger the win 🏆 - Celebrate big with emojis 🎊
- Count the treasure coins 🪙
- Make it personal with the name 😊
Next: handling losing (Game Over)! 💀
print("I found the treasure! 💎🥇")Quick Check ✅
Let's test your winning skills! 🧠
Recap Time! 🎒
Great work, treasure hunter! 🌟
iftriggers the win 🏆- Celebrate with emojis and ASCII trophies 🎊
- Count coins, check health 📊🪙
- Personalize with the player's name 😊
Next: what happens when you LOSE? 💀
print("Finding Treasure: complete! 🚀")Frequently asked questions
Is the “Finding Treasure” lesson free?
Yes — the full text of “Finding Treasure” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.
What will I learn in “Finding Treasure”?
Win the game. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Coding for Kids?
No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Finding Treasure” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Coding for Kids lesson?
Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Planning the Adventure
- Making Choices
- Finding Treasure
- Game Over