Explains briefly what local scope is in Python
code
#!/usr/bin/env python
func_demo.py
basic function
scope of variable
def addme(val1,val2):
z = val1 + val2
this ok - local scope
z is only available in the function
print("In the function",z)
return z
x = int(input("Enter a value for x "))
y = int(input("Enter a value for y "))
this is not defined
local scope not global scope
#print(z)
total=addme(x,y)
print(total)
Watch video local scope in Python online without registration, duration hours minute second in high quality. This video was added by user d p 02 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 12 once and liked it 0 people.