Suraj Davey Suraj Davey - 1 year ago 59
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.

Answer Source

Try this:

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