I am trying to make an insertion sorting program that sorted a list in ascending order. I'm getting the error:
line 16, in <module> if listNums[x] < listNums[i]:
For this program:
listNums = [54, 21, 76, 43, 65, 98, 65, 32, 34, 38]
x = 1
i = 0
Copy = 0
for z in range (0, len(listNums)):
if listNums[x] < listNums[i]:
Copy = listNums[i]
listNums[i] = listNums[x]
listNums[x] = Copy
i = i + 1
x = x + 1
print(listNums)
bisectmodule will do all the work for you...