L = [1,-2,3,7,-8,-9,10]
j=len(L)-1
i = 0
k = 0
while i<j:
while L[i]>0:
i=i+1
while L[j]<0:
j=j-1
if i<j:
k = L[i]
L[i]=L[j]
L[j] = k
print(L)
微信掃碼預(yù)覽、分享更方便
2006-2024 深圳市思高達(dá)科技有限公司 粵ICP備14099982號(hào) 粵公網(wǎng)安備 44030702004423號(hào)