Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Local vs. Global Variables | Variable Scope, Nested Functions, and Closures
Functional Programming Concepts in Python
Sección 3. Capítulo 2
single

single

Local vs. Global Variables

Desliza para mostrar el menú

Tarea

Desliza para comenzar a programar

Create a function that demonstrates the difference between local and global variables by modifying a global variable inside a function.

  • Use the global keyword to modify the global variable x inside the function;

  • Assign the value 20 to x within the function;

  • Create a local variable y inside the function and assign it the value 5.

Solución

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 3. Capítulo 2
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

some-alt