Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Local vs. Global Variables | Variable Scope, Nested Functions, and Closures
Functional Programming Concepts in Python
Sectie 3. Hoofdstuk 2
single

single

Local vs. Global Variables

Veeg om het menu te tonen

Taak

Veeg om te beginnen met coderen

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 2
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt