Chapter 5 · Quest 1 of 5 · 10 XP
To-Do Boss
📋 Big goals are scary. Agents break them into steps first. Ask Pip for a plan and you get a list back:
import pip
print(pip.plan("plant a tree"))['dig a hole', 'plant the seed', 'water it']
enumerate() counts for you as you loop. Start it at 1 and you get numbered steps:
for n, step in enumerate(["wake up", "eat"], 1):
print(n, step)1 wake up 2 eat
Instructions
- Store
pip.plan("bake a cake")insteps. - Print each step numbered like
1. buy flour, usingenumerate. - After the list, print
3 steps to go!usinglen(steps).
💡 Hint
for n, step in enumerate(steps, 1): print(str(n) + ". " + step). Then, outside the loop, print(str(len(steps)) + " steps to go!").
bot.py
Terminal