Python - Magic Methods and Operator Overloading
What will be the output of this code?
class Count:
def __init__(self, limit):
self.limit = limit
self.num = 0
def __iter__(self):
return self
def __next__(self):
if self.num < self.limit:
self.num += 1
return self.num
else:
raise StopIteration
for i in Count(3):
print(i, end=' ')