def x(a):
n=len(a);
tcount=1
while (n > 1):
m=0;
count=0;
while m < n-1:
if a[m]>a[m+1]:
a[m],a[m+1]=a[m+1],a[m];
m+=1;
else:
m+=1;
count+=1;
if(count==(n-1)):
flag = True
break
if(flag):
break
n-=1;
tcount+=1;
print("共排序",tcount,"次");
return a
暂未找到异常返回函数,这样就可以直接在count计数中跳出整个循环提,结束总循环