"""doc"""

class Cars:
    """
    doc
    """
    def __init__(self, start_series, peaces):
        """
        doc
        :param start_series:
        :param peaces:
        """
        self.series = list(range(start_series, start_series + peaces))

    def right(self):
        """
        doc
        :return:
        """
        return self.series[::2] if self.series[0] % 2 == 0 else self.series[1::2]

    def left(self):
        """
        doc
        :return:
        """
        return self.series[1::2] if self.series[0] % 2 == 0 else self.series[0::2]

    def __iter__(self):
        return LotIter(self.series)


class LotIter:
    """
    doc
    """
    def __init__(self, series):
        """
        doc
        :param series:
        """
        self.lots = list(range(series[0] // 20, series[-1] // 20))

    def __iter__(self):
        """
        doc
        :return:
        """
        return self

    def __next__(self):
        """
        doc
        :return:
        """
        if len(self.lots):
            return self.lots.pop(0)
        else:
            raise StopIteration


cars = Cars(314, 90)
print(cars.right())
print(cars.left())

with open('data.txt', 'w') as data_file:
    for lot in cars:
        data_file.write(str(lot) + '\n')
