Answers for "does a function have access to a variable in another function"

1

how to access variable of one function in another function in python

def fun1():
    fun1.var = 100
    print(fun1.var)

def fun2():
    print(fun1.var)

fun1()
fun2()

print(fun1.var)
Posted by: Guest on May-31-2021

Code answers related to "does a function have access to a variable in another function"

Python Answers by Framework

Browse Popular Code Answers by Language