Answers for "I want to define a variable in one function and use it in another"

0

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=" ")
Posted by: Guest on November-26-2020

Code answers related to "I want to define a variable in one function and use it in another"

Python Answers by Framework

Browse Popular Code Answers by Language