Challenge: Modifying a Global Variable in Python
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.7
Challenge: Modifying a Global Variable in Python
Swipe to show menu
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 3
single