KnowledgeBoat Logo

Computer Science

Predict the output:

a, b, c = [1,2], [1, 2], [1, 2]
print(a == b)
print (a is b)

Python

Python List Manipulation

18 Likes

Answer

True
False

Working

As corresponding elements of list a and b are equal hence a == b returns True. a is b returns False as a and b are two different list objects referencing two different memory locations.

Answered By

6 Likes


Related Questions