Machine Learning, Python.
like a good idea because it requires you to create extra variables to store the indices. However, in cases with hundreds of states, using a transition matrix is much more efficient than using the simple dictionary implementation. In the case of a transition matrix, you can simply use NumPy indexing