def shell_sort(lists):
count = len(lists)
step = 2
group = count/step
group = int(group)
print(group)
while group > 0:
for i in range(0,group):
j = i + group
while j < count:
k = j - group
key = lists[j]
while k >= 0:
if lists[k] > key:
lists[k + group], lists[k] = lists[k], key
else:break
k -= group
j += group
group /= step
return lists
每次运行会显示'float' object cannot be interpreted as an integer错误
请问是怎么回事
极有可能的原因是倒数第二行中的group为float值,导致在大循环while group > 0:
for i in range(0,group):中的range出了问题!!!
话说为什么没有缩放!!!
代码贴全了?从贴出的代码看不出问题出在哪里