Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Modifying a Global Variable | Variable Scope
Intermediate Python: Arguments, Scopes and Decorators
course content

Contenido del Curso

Intermediate Python: Arguments, Scopes and Decorators

Intermediate Python: Arguments, Scopes and Decorators

1. Packing and Unpacking
2. Arguments in Function
3. Function as an Argument
4. Variable Scope
5. Decorators

Challenge: Modifying a Global Variable

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 4. Capítulo 3
toggle bottom row

Challenge: Modifying a Global Variable

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 4. Capítulo 3
toggle bottom row

Challenge: Modifying a Global Variable

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Tarea

This task shows how you can modify a global variable from within a function using the global keyword.

  1. Use the keyword global for receiving access to modify global_var;
  2. Increase global_var value on to 5;
  3. Call the function modify_global to implement changes;
  4. Print modified global_var.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 4. Capítulo 3
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