InterviewSolution
Saved Bookmarks
| 1. |
Global Statement |
|
Answer» To modify a global variable from inside a function, we use the global statement: def func():global value value = "Local" value = "Global" func() print(value) Output: Local We set the value of “value” as Global. To change its value from inside the function, we use the global keyword along with “value” to change its value to local, and then print it. |
|