Scope, Global Variables and Global Keyword

 # Scope, Global Variables and Global Keyword


l= 10 # Global: Used by everyone, Sarkar Ka Money.(Anyone can use)

def function1 (n):
global l
l = 5 #Local: Onyl the function can use it, Personal Money.
m = 8 #Local
l= l+ 45
print(l, m)
print(n, "I have Printed")

function1("This Is Me")

# Global is read only variable. We can't Add,multiply, or do anything else.
# Global Keyword is the permission/order to change the Global variable

Comments

Popular posts from this blog

Practice Execise 3

Pickle Module