1def fun1():
2 fun1.var = 100
3 print(fun1.var)
4
5def fun2():
6 print(fun1.var)
7
8fun1()
9fun2()
10
11print(fun1.var)
12
1>>> def oneFunction(lists):
2 category=random.choice(list(lists.keys()))
3 return random.choice(lists[category])
4
5
6>>> def anotherFunction():
7 for letter in oneFunction(lists):
8 print("_",end=" ")
9
1class Spam:
2 def oneFunction(self,lists):
3 category=random.choice(list(lists.keys()))
4 self.word=random.choice(lists[category])
5
6 def anotherFunction(self):
7 for letter in self.word:
8 print("_",end=" ")
9