โ ๐ Python World
๐ Dog Years
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
- Multiply with the * symbol.
- return age * 7
๐งช Coach checks
- โฏ 3 people-years
- โฏ newborn pup
- โฏ 10 people-years
Live coach
Getting ready
โโโ
๐ฌ Multiply with * and return the answer.
def cat_years(age):
return age * 5
print(cat_years(3)) # 15
print(cat_years(10)) # 50
๐ It printed:
Nice โ you saw it work!
๐ Output
๐งฉ Gaps filled! Ready to write it all yourself?