I'm trying to make a program that compares two lists and returns "True" if they're both have the same variables in it and "False" else.
The code is:
def are_lists_equall(list1, list2):
if len(list1) == len(list2) and list1.sort() == list2.sort():
return True
else:
return False
list1 = [0.6, 1, 2, 3]
list2 = [9, 0, 5, 10.5]
print(are_lists_equall(list1, list2))
And the output is:
True
Why is this happening?