2

「TypeError: object of type 'Phone' has no len()」および「'Phone' object has no attribute ' getitem '」を取得しています。

class Phone(object):

    def __init__(self, number):
        self.number = number

    def number(number):
        '''Test if the number is valid or not'''

        for i in range(number):

            n = ''.join(i for i in number if i.isdigit())

            if (len(n) >= 12) or (len(n) <= 9):
                return '0' * 10
            elif len(n) == 11 and n[0] != 1:
                return '0' * 10
            elif n[0] == 1 and len(n) == 11:
                return n.pop[0]
            else:
                return n
4

1 に答える 1