how to use a varibale in a funtion to another function in 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
class Spam:
def oneFunction(self,lists):
category=random.choice(list(lists.keys()))
self.word=random.choice(lists[category])
def anotherFunction(self):
for letter in self.word:
print("_",end=" ")