Lesson 2 of 7
Your first function
A function is a recipe with a name: you write it once with def, then use it as many times as you like.
return hands back the recipe's result — you can store it in a variable or print it.
def hello(name):
return "Hi " + name
print(hello("Lina"))🎯 Your mission
Write a function double(x) that returns x times 2, then print double(4).
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →