Programming Example
Write a Python program to show the application of Global variable.
Solution
x="global" def check(): global x print(x) x="Local" #x="Local" check() print(x)
Output
global
Local
Write a Python program to show the application of Global variable.
Solution
x="global" def check(): global x print(x) x="Local" #x="Local" check() print(x)
Output
global
Local