3 ms·
It will have memory impact though with larger range. A better approach might be: squares = lambda: (x * x for x in range(10)) print(min(squares))
by skbly7 8y ago
It will have memory impact though with larger range.
A better approach might be:
squares = lambda: (x * x for x in range(10))
print(min(squares))
print(max(squares()))
- rahimnathwani 8y agoYes, your solution is in the original post, under the heading 'Python solutions': def squares(): return (x * x for x in range(10))