What result 'return' show?

https://www.codecademy.com/paths/data-science/tracks/dspath-functions-and-logic/modules/dspath-python-functions/lessons/python-functions-syntax-cc/exercises/all-operations

why this two task one show the return and one doesn’t?

Hello @haodo9x2317615806.

Consider what return does. It sends what follows back to the line of code that called the function.
In your first screen shot,
return(3*num) sends 3*num back to where?
Here: first_three_multiples(10)
and here: first_three_multiples(0)
Once the value is sent back to these lines, what happens to it? Nothing. It’s gone.

In your second screen shot,
return fourth sends fourth back to where?
Here: print(lots_of_math(1, 2, 3, 4))
and here: print(lots_of_math(1, 1, 1, 1))
Once the value is sent back to these lines, what happens to it? It’s now the argument supplied to the print() function.
That’s the difference.

2 Likes

oh, i missed the print in

print(lots_of_math(1, 2, 3, 4))

i figured it out, thank you.

2 Likes