Other Fun Stuff in the itertools Module
import itertoolsprint (list(itertools.product('ABC', '123'))) #①#[('A', '1'), ('A', '2'), ('A', '3'),# ('B', '1'), ('B', '2'), ('B', '3'),# ('C', '1'), ('C', '2'), ('C', '3')]print (list(itertools.combinations('ABC', 2))) #②#[('A', 'B'), ('A', 'C'), ('B', 'C')]
Get hands-on with 1400+ tech skills courses.