Challenge: Modifying a Global Variable in Python
Tehtävä
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_var
value on to 5; - Call the function
modify_global
to implement changes; - Print modified
global_var
.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 4. Luku 3
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 3.7
Challenge: Modifying a Global Variable in Python
Pyyhkäise näyttääksesi valikon
Tehtävä
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_var
value on to 5; - Call the function
modify_global
to implement changes; - Print modified
global_var
.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Awesome!
Completion rate improved to 3.7Osio 4. Luku 3
single