part of the solution of this code involves this:
if i > outputlist[-1]:
what on earth is outputlist[-1]? isnt the value inside the square brackets supposed to be the index? isnt the smallest possible index value 0 i.e. the very first item in a list?
python allows to use negative indexes to access values from the right hand side of the list, so
-1 is the last item, -2 is the second to last item in the list, and so on