python simplifications

Hi Joe,

Overall, this is great! I just added some simplifications because it was a little hard to read some of your code. Additionally, this version will be faster since it avoid the O(n) time iterable.index() function. Try to understand the changes I made; in particular using the `enumerate` function and passing a custom key to the `min` function, and let me know if you have any questions.