Question
How to check if two lists are equal?
Solution
โ Verified
To check if two lists are equal (same elements in the same order), use the == operator.
Example :--ย
list1 = [1, 2, 3]
list2 = [1, 2, 3]
if list1 == list2:
print("Lists are equal")
else:
print("Lists are not equal")
Click here to download practice questions on
Python Lists