Is it possible to get which values are duplicates in a list using python?
I have a list of items:
mylist = [20, 30, 25, 20]
I k
The following code will fetch you desired results with duplicate items and their index values.
for i in set(mylist): if mylist.count(i) > 1: print(i, mylist.index(i))