Jun-26-2020, 01:26 PM
You have
i think what you are looking for is
The following
print(''.join(str(next(self) for j in range(n))))which is turning a generator into a string
str(next(self) for j in range(n))
i think what you are looking for is
print(''.join(str(next(self)) for j in range(n)))which is turning the next item into a string
str(next(self))
The following
print(type(i for i in range(2)))creates a generator
Output:<class 'generator'>
whereas including square bracketsprint(type([i for i in range(2)]))creates a list
Output:<class 'list'>