def ReOrderOddEven(li):
'''思路:1.如果low索引元素为奇数就+1.知道找到为偶数的下标;2.如果high为偶数 就-1 直到找到基数的下标3,交换的条件是:左边为偶数,右边为基数'''
low = 0
high = len(li) - 1
while low < high:
if li[low] % 2 == 0 and li[high] % 2 == 1:
li[low], li[high] = li[high], li[low]
if li[low] % 2 == 1:
low += 1
if li[high] % 2 == 0:
high -= 1
return li
print(ReOrderOddEven([1, 1, 2, 2, 3, 3, 5]))