Global and local Variable in python-17

 


a=8
def function1():
#a=6

#function ar vetora thaka bairer global man change kora jai na
#forcefully change korte hole nicher moto kore global ullekh kore korte hoi
global a
a = 7
#jodi vator a A er man na thakto tahole bairer ta neto ,a=6 comment kore dakho
#function ar vetor a print marle vetorer a ar man ta ashe
print(a)

function1()

#function ar vetore print marle global a ar man ta ashe
print(a)


#next example

#############################


def harry():
x=20
def rohan():
global x;
x=9
print("before calling rohan",x)
rohan()
print("after calling rohan", x)
harry()

#2 khatre e 20 print korbe karon aikhane global veriable e nai change kmne korbe.
# harry ar x ar man obossoi global noy ota or localman

Comments

Popular posts from this blog

D WEB LINK