$ python sort.py i: 0 list: [] Traceback (most recent call last): File "sort.py", line 14, in sort(l) File "sort.py", line 7, in sort if l[pos] > l[pos+1]: IndexError: list index out of range