Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Functions within Functions | Functions within Functions
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

Functions within Functions

Inside the function, we can not only write loops, declare variables, use if-else statements but also call other functions. Let's look at an example.

1234567
def function_1(): # Outer function print('I am an outer function') def function_2(): # Inner function print('I am an inner function ') function_2() function_1()

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

¿Todo estuvo claro?

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

Functions within Functions

Inside the function, we can not only write loops, declare variables, use if-else statements but also call other functions. Let's look at an example.

1234567
def function_1(): # Outer function print('I am an outer function') def function_2(): # Inner function print('I am an inner function ') function_2() function_1()

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

¿Todo estuvo claro?

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

Functions within Functions

Inside the function, we can not only write loops, declare variables, use if-else statements but also call other functions. Let's look at an example.

1234567
def function_1(): # Outer function print('I am an outer function') def function_2(): # Inner function print('I am an inner function ') function_2() function_1()

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

¿Todo estuvo claro?

Inside the function, we can not only write loops, declare variables, use if-else statements but also call other functions. Let's look at an example.

1234567
def function_1(): # Outer function print('I am an outer function') def function_2(): # Inner function print('I am an inner function ') function_2() function_1()

Tarea

You have to implement two functions:

  • outer_function - this is an outer function that displays text like this: The perimeter of this square is equal to:
  • inner_function - this is an inner function, which calculates the perimeter of a square whose side is 7.

Sección 5. Capítulo 1
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt