โ ๐ Python World
๐ Rocket Launch
You can practise without a player, but pick a player to score points!
๐ The mission
Today you unlock
Loops inspect each item
Many levels use a loop: start with a simple value, visit each item, update the answer, then return it at the end.
๐ก Hint ladder
- range(n, 0, -1) counts n, n-1, โฆ 1.
- Make the list, then .append("Lift off!")
- One-liner: list(range(n, 0, -1)) + ["Lift off!"]
๐งช Coach checks
- โฏ from 3
- โฏ from 1
- โฏ from 5
Live coach
Getting ready
โโโ
๐ฌ range(n, 0, -1) counts down. list() turns it into a list you can add to.
print(list(range(1, 4))) # [1, 2, 3] print(list(range(3, 0, -1))) # [3, 2, 1] print([1, 2] + ["go"]) # [1, 2, 'go']
๐ It printed:
Nice โ you saw it work!
๐ Output
๐งฉ Gaps filled! Ready to write it all yourself?