How can I limit iterations of a loop?
How can I limit iterations of a loop in Python? for index, item in enumerate(items): print(item) if index == limit: break Is there a shorter, idiomatic way to write the above? How? Including the index zip stops on the shortest iterable of its arguments. (In contrast with the behavior of zip_longest, which uses the longest … Read more