from collections import Counter
class Runlength:
    def __init__(self):
        self.str = 0 
    def returner(self,str):
        self.str = str 
        self.__str = ','.join(str(n) for n in self.__str)
        self.__str = self.__str[::-1]
        self.__str = self.__str.replace(',', '')
        return self.__str
    def final(self,num):
        self.num = num 
        k = []
        c = Counter(self.num).most_common()
        for x in c:
        k += x     
        return k
math = Runlength() 
def Main():
a = "aabbcc"
b = math.returner(a)
c = math.final(b)
print(c)
Main()
The program takes a word as input and gives the occurrence of each repeating character and outputs that number along with a single character of the repeating sequence.
I cant figure it out, why this doesn't work. I get this error:
NameError: global name 'returner' is not defined
 
     
     
     
    