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 itertoolsAll lessons in this course
- Brute Force Is a Valid Strategy
- Enumerate with itertools
- Bitmask Subset Enumeration
- Trim the Search Space Smartly