CodeAgeBy Sitezack
Final project: your text RPGYour choose-your-own adventure0 XP
Chapter progress0/6

Lesson 1 of 6

Create your hero

A dictionary stores several pieces of info under labels: hero = {"name": "Nova", "hp": 20}. You read a value with hero["hp"].

It's the perfect character sheet: name, health points (hp), power… all in one place.

hero = {"name": "Nova", "hp": 20}
print(hero["name"])
hero["hp"] = 18

🎯 Your mission

Create the dictionary hero with three labels: "name" (any name you like), "hp" worth 20 and "power" worth 5. Print hero["hp"].

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO