Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Building functions | What is Function in Python?
Python Functions Tutorial
course content

Contenido del Curso

Python Functions Tutorial

Python Functions Tutorial

1. What is Function in Python?
2. Positional and Optional Arguments
3. Arbitrary Arguments
4. Function Return Value Specification
5. Recursion and Lambda Functions

bookChallenge: Building functions

Let's get to know each other. I wrote a function that will output my name to you, and you will write a function that will output your name.

12345678
# Define the function say_my_name def say_my_name(): # The function prints the string 'My name is Heisenberg' print('My name is Heisenberg') # Call the function say_my_name say_my_name()
copy

So, the say_my_name function simply prints the phrase 'My name is Heisenberg' to the screen, and we can call this function to see this output.

Tarea

You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name.

Once you've completed this task, click the button below the code to check your solution.

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 2
toggle bottom row

bookChallenge: Building functions

Let's get to know each other. I wrote a function that will output my name to you, and you will write a function that will output your name.

12345678
# Define the function say_my_name def say_my_name(): # The function prints the string 'My name is Heisenberg' print('My name is Heisenberg') # Call the function say_my_name say_my_name()
copy

So, the say_my_name function simply prints the phrase 'My name is Heisenberg' to the screen, and we can call this function to see this output.

Tarea

You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name.

Once you've completed this task, click the button below the code to check your solution.

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 2
toggle bottom row

bookChallenge: Building functions

Let's get to know each other. I wrote a function that will output my name to you, and you will write a function that will output your name.

12345678
# Define the function say_my_name def say_my_name(): # The function prints the string 'My name is Heisenberg' print('My name is Heisenberg') # Call the function say_my_name say_my_name()
copy

So, the say_my_name function simply prints the phrase 'My name is Heisenberg' to the screen, and we can call this function to see this output.

Tarea

You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name.

Once you've completed this task, click the button below the code to check your solution.

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!

Let's get to know each other. I wrote a function that will output my name to you, and you will write a function that will output your name.

12345678
# Define the function say_my_name def say_my_name(): # The function prints the string 'My name is Heisenberg' print('My name is Heisenberg') # Call the function say_my_name say_my_name()
copy

So, the say_my_name function simply prints the phrase 'My name is Heisenberg' to the screen, and we can call this function to see this output.

Tarea

You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name.

Once you've completed this task, click the button below the code to check your solution.

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 2
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt