Compare two lists in python where the elements are in different order
Question: I have multiple lists e.g.

    
    
    list1=[1,4,5]
    list2=[4,1,5]
    list3=[1,5,4]
    

two lists are considered same if they have the same elements. Also the lists
can be nested lists

    
    
    list1=[[1,4],5,4]
    list2=[5,4,[1,4]]
    

How do i compare them?


Answer: You can `flatten` your lists then use `set` to keep the unique elements then
compare :

    
    
    >>> from compiler.ast import flatten
    >>> list1=[[1,4],5,4]
    >>> list2=[5,4,[1,4]]
    >>> set(flatten(list1))==set(flatten(list2))
    True
    

