How to let a function access the variables of another function python code example
Example 1: how to use variable from another function in python
s = Spam()
s.oneFunction(lists)
s.anotherFunction()
Example 2: how to use variable from another function in python
>>> def oneFunction(lists):
category=random.choice(list(lists.keys()))
return random.choice(lists[category])
>>> def anotherFunction():
for letter in oneFunction(lists):
print("_",end=" ")