Header Ads

Responsive Ads Here

Scope of Variables

Scope of Variables 



num = 20  # Global variables

def test1():
    global num
    num = 10  # Local variables
    return num

# def test2():
#     return num

# print(test2())
print(num)
print(test1())
print(num)

Powered by Blogger.