Challenge: Modifying a Global Variable in Python
Uppgift
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 allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 3
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Sammanfatta detta kapitel
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.7
Challenge: Modifying a Global Variable in Python
Svep för att visa menyn
Uppgift
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 allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 3
single