Scope of Variable

Lesson Progress
0% Complete

Local & Global Variables

global_1 = 'I am a global Variable, defined outside the function'
def check_variable(): # created a function
    	local_1 = 'This is Local Variable' # created local variable inside function
    	print(f'{global_1}\n"called from inside a function"') # accessing global variable
    	print(f'\n{local_1}\n"called from inside a function"') # accessing local variable 
check_variable() # calling the function