In the first example, I don’t understand what’s happening with permutations. and In both, I don’t understand the syntax of putting a comma after a ; while indexing a list.

The , separates dimensions. Here shuffled_X is a two-dimensional array of shape (input size, number of examples), so shuffled_X[:, 0 : mini_batch_size] selects all inputs (:) for the first mini_batch_size examples (0 : mini_batch_size).

np.random.permutation returns a permuted range from 0 to m-1, so X[:, permutation] selects all inputs (:) for all the examples arranged in a random order determined by permutation (i.e., it shuffles the examples).

NumPy’s documentation explains it much better, so I recommend you take a look at it too