Challenge: Modifying a Global Variable in Python
Opgave
Swipe to start coding
This task shows how you can modify a global variable from within a function using the global keyword.
- Use the keyword global for receiving access to modify
global_var; - Increase
global_varvalue on to 5; - Call the function
modify_globalto implement changes; - Print modified
global_var.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 3
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Fantastisk!
Completion rate forbedret til 3.7
Challenge: Modifying a Global Variable in Python
Stryg for at vise menuen
Opgave
Swipe to start coding
This task shows how you can modify a global variable from within a function using the global keyword.
- Use the keyword global for receiving access to modify
global_var; - Increase
global_varvalue on to 5; - Call the function
modify_globalto implement changes; - Print modified
global_var.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 3
single