โ ๐ Python World
๐ Secret Code
You can practise without a player, but pick a player to score points!
๐ The mission
Today you unlock
Functions return answers
A function is a tiny machine: it receives inputs, works something out, then returns one answer for the tests to check.
๐ก Hint ladder
- Slicing magic: word[::-1] reverses a string.
- Or build it letter by letter with a loop.
๐งช Coach checks
- โฏ reverses python
- โฏ reverses abc
- โฏ one letter
- โฏ empty word
Live coach
Getting ready
โโโ
๐ฌ Slicing magic: word[::-1] reads a string backwards.
word = "python" print(word[0]) # p (first letter) print(word[0:3]) # pyt (first three) print(word[::-1]) # nohtyp (backwards!)
๐ It printed:
Nice โ you saw it work!
๐ Output
๐งฉ Gaps filled! Ready to write it all yourself?