max and min both have “key” as a parameter, therefore one can use it flexibly.
example 1:
      dist = {"a":3, "b":2, "c":1}
      we want to get the key with the largest value
      normally max(dist) will return "c"
      but max(dist, key=dist.get) will do as we expect
example 2:
      lst = [(1,9,3),(4,5,6)]
      we want to get an item with the largest second element
      max(lst) = (4,5,6)by default
      max(lst,key=lambda x:x[1]) = (1,9,3)

itertools.product is powerful
repeat means repeat itself multiple times
For example, product(A, repeat=4) means the same as product(A, A, A, A).

# product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
# product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111

There are also permutation and combination in itertools.