list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] list2 = [] list3 = [] for i in list1: if i % 2 != 0: list2.append(i) elif i % 2 == 0: list3.append(i) print(list2) print(list3) #Output [1, 3, 5, 7, 9] [2, 4, 6, 8] Aman Kharwal I'm a writer and data scientist on a mission to educate others about the incredible power of data📈. Articles: 1535 Previous Post QR Code with Python Next Post Smallest and Largest Number in a List