Suraj Davey Suraj Davey - 2 months ago 7
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

Try this:

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