リストを昇順にソートする挿入ソートプログラムを作成しようとしています。Pythonの挿入ソートエラー
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)
はあなたがrrorの実際のテキストは何ですか与え理由ですリストの長さを超えて取得? – Amber
'bisect'モジュールはあなたのためにすべての仕事をします... – thebjorn