Output: Return
Challenge 2-1: Functions
Challenge 2-1: Functions
This time let's use return instead of print.
>>> def double(number):
return number * 2
We call the function, passing it the number 12:
>>> double(12)
24
We call the function again, assigning the value to the variable new_number:
>>> new_number = double(12)
24
Now what happens here?
>>> new_number
24
>>> new_number
24
This time when you give new_number a value from the function, it will return that value - 24 - and now the value is saved.
When you type new_number again, you’ll see the same value until you decide to change it.