def double(number):
result = number * 2
return resultLine-by-line explanation
defbegins the function named double.numberis its parameter.- The indented calculation creates a result.
returnsends that result back.
answer = double(4)Line-by-line explanation
- The function is called with 4.
- Inside the function, number receives 4.
- The returned value 8 is stored in answer.