Using itertools for Advanced Iteration in Python


The itertools module provides a collection of tools for complex iteration patterns.

Source Code

import itertools
for combination in itertools.combinations([1, 2, 3], 2):
    print(combination)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments