I have two lists. the contents may be different. I best method to check and return True
if both list have same contents. For eg: [3,4,5]
and [4,3,5]
then must Return True
Here is what i tried.
>>> x=[3,4,5]
>>> y=[4,3,5]
>>> x==y
False
>>> x is y
False
>>> x in y
False
it doesn't worked,
but when i tried these with sort()
it worked :
>>> x.sort()
>>> y.sort()
>>> x==y
True
is this is correct method? Any thing better than this??