Course Content
Intermediate Python Techniques
Intermediate Python Techniques
2. Arguments in Function
3. Function as an Argument
Challenge: Modifying a Global Variable
Task
Swipe to begin your solution
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_var
value on to 5; - Call the function
modify_global
to implement changes; - Print modified
global_var
.
Solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 3
Challenge: Modifying a Global Variable
Task
Swipe to begin your solution
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_var
value on to 5; - Call the function
modify_global
to implement changes; - Print modified
global_var
.
Solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 3
Switch to desktop for real-world practiceContinue from where you are using one of the options below