Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Print vs Return | What is a Function?
Python Functions: From Zero to Hero
course content

Contenido del Curso

Python Functions: From Zero to Hero

Python Functions: From Zero to Hero

1. What is a Function?
2. Arguments or Parameters
3. Assigning a Default Value to a Parameter
4. An Unknown Number of Arguments
5. Functions within Functions
6. Recursion

bookPrint vs Return

print() is a function called by a person. If you want to show the value to a person then you need to use the function print ().

return is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.

12345678
def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
copy

Tarea

You need to implement a function named function_adding. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23, store the result in a variable sum and return it.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 5
toggle bottom row

bookPrint vs Return

print() is a function called by a person. If you want to show the value to a person then you need to use the function print ().

return is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.

12345678
def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
copy

Tarea

You need to implement a function named function_adding. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23, store the result in a variable sum and return it.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 5
toggle bottom row

bookPrint vs Return

print() is a function called by a person. If you want to show the value to a person then you need to use the function print ().

return is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.

12345678
def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
copy

Tarea

You need to implement a function named function_adding. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23, store the result in a variable sum and return it.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

print() is a function called by a person. If you want to show the value to a person then you need to use the function print ().

return is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.

12345678
def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
copy

Tarea

You need to implement a function named function_adding. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23, store the result in a variable sum and return it.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 5
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt