(2/10)

Functions That Give Back (Return Values) — Python typing lesson

Master return values to get results from functions.

What you'll practice

Some functions can give you a value back! The `return` keyword sends the result out of the function.

  • `return` sends a value back to where the function was called.
  • We can store the returned value in a variable, like `result`.

Pro Access Required

This is a premium lesson. Upgrade to Pro to unlock this interactive exercise and continue your learning journey.

🐍Python

Functions That Give Back (Return Values)

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
6
def double_this(number):↵
return number * 2↵
↵
my_number = 5↵
result = double_this(my_number)↵
print(result)
0 / 107
Press This!
👇
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
⌫
⇥
Q
W
E
R
T
Y
U
I
O
P
[{
]}
\|
⇪
A
S
D
F
G
H
J
K
L
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky