Find and write the output of the following python code:
a=10
def call():
global a
a=15
b=20
print(a)
call()
Answer:
- a is initially declared as a global variable and assigned the value 10
- Then a function call( ) is created where a is assigned the value 15 and b is assigned the value 20. So now, the value of a is updated from 10 to 15 .
- a is printed when the function is called.
- So, the output will be 15.