def __next__(self):
    self.start += 1
squareroot = math.sqrt(self.start)
while squareroot != math.ceil(squareroot):
    if self.start > self.stop:
        raise StopIteration
self.start += 1
squareroot = math.sqrt(self.start)
Calculating the square numbers within a range (python)