Changed to 0 base along with everything else.
If num is out of bounds, you get "IndexError: list index out of range" which seems fine.

The admittedly hideous "typ" was so the code does not shadow the built in "type" function which was a rule from some past project. The code works fine either way so I'll change it.