Commit dce9fe39 by BellCodeEditor

save project

parent c9c02297
Showing with 9 additions and 5 deletions
alist = [88, 75, 72, 82, 90, 85, 78, 91] alist = [88, 75, 72, 82, 90, 85, 78, 91]
s=0
cd=len(alist) cd=len(alist)
for i in range(cd-1): for i in range(cd-1):
for j in range(i,cd-1): for j in range(cd-1-i):
if alist[i]>alist[j]: s=s+1
if alist[i]>alist[j+1]:
#t=alist[i] #t=alist[i]
alist[i],alist[j]=alist[j],alist[i] alist[i],alist[j+1]=alist[j+1],alist[i]
print(alist) print(alist)
\ No newline at end of file print(s)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment