use negative index to count from the end of a list
I see a lot of stuff like this in the code:
output[len(output)-1]
This is equivalent to, and less idiomatic than, just using a negative index to count back from the end of the list, e.g.:
output[-1]
Edited by Jameson Rollins