0PricingLogin
Competitive Programming Academy · Lesson

Enumerate with itertools

Products, combinations, and permutations.

Let itertools Do the Loops

Python's itertools generates combinations and orderings for you, so you write less loop code and make fewer mistakes. 🙂

Import It First

Everything lives in one module, so start with import itertools. Then you can call product, permutations, and combinations directly.

import itertools

All lessons in this course

  1. Brute Force Is a Valid Strategy
  2. Enumerate with itertools
  3. Bitmask Subset Enumeration
  4. Trim the Search Space Smartly
← Back to Competitive Programming Academy