Some Basic Python List Programs-3

Some Basic Python List Programs-3

Python program to remove duplicates from a list list1 = [2, 6, 9, 8, 4, 8, 6, 6, 5, 7, 2, 4] #using list comprehension list2 = [] [list2.append(ele) for ele in list1 if ele not in list2] print(list2) #Output: [2, 6, 9, 8, 4, 5, 7] #using list comprehension and enumerate() list3 = [ele … Read more

%d bloggers like this: