Informatics Practices

Consider the following lists:

A = [1,2]
B = [1,2]

What will be the output of the following?

print(A==B)
  1. True
  2. False
  3. Error
  4. No output

Python List Manipulation

2 Likes

Answer

True

Reason — When comparing lists A and B using the "==" operator print(A == B), Python checks if both lists have the same elements in the same order. In this case, both lists A and B contain the elements [1, 2], so the comparison A == B evaluates to True.

Answered By

3 Likes


Related Questions