def part(lists):
i=0
j=len(lists)-1
while i<j:
while i<j and lists[i]%2==1:
i+=1
while i<j and lists[j]%2==0:
j-=1
if i<j:
lists[i],lists[j]=lists[j],lists[i]
return lists
网友评论