Question

How to check if two lists are equal?

Updated on June 2, 2025 | By Learnzy Admin | ๐Ÿ‘๏ธ Views: 161 students

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")
Was this solution helpful? 41
Click here to download practice questions on Python Lists

More Questions on Python Lists

Question 1

Find common elements in two lists


View solution
Question 2

Is Python list mutable?


View solution
Question 3

How to remove duplicates from a list?


View solution
Question 4

Difference between sort() and sorted()?


View solution
Question 5

What is a list in Python?


View solution
Question 6

How to remove an element from a list?


View solution
Question 7

What is the difference between append() and extend()?


View solution