Suraj Davey Suraj Davey - 6 months ago 36
Python Question

finding the position in the python list where element differs

l1 = [1,2,2,2]

In the list above I know that the element differs in l1[0] is there any way to fetch in dynamically in python. Thanks in advance.


Try this:

l1.index(min(set(l1), key=l1.count))