list1=[1,4,7,9,2,13,6,1,10] def func1(x): return x%2 list1=sorted(list1,key=func1) print(list1)