Definition of a function, the integer achieve the even list on the left, to the right of the odd (without the aid of other lists)

def parse_list(list):
    if len(list)==1 and type(list[0])=='int':
        return list
    else:
        for i in list:
            if i%2==0:
                list.remove[i]
                list.insert[0,i]
        return list


l=[1,2,3,4,56,64,23]
parse_list(l)

 

 

 

Arch day a soldier.

Guess you like

Origin www.cnblogs.com/qfdmmh/p/10938010.html