Related to quiz

def func():
global value
value = “Local”
value = “Global”


#explain why its giving global as output when two variables are in same indentation

In this code when a function is called a single variable named value is declared as global
so first value->Local in this line “Local” is assigned and after that you can see value got assigned with different string that is “Global”.so finally in value “Global” string is stored and finally it got printed.

1 Like