ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print([1, 2] < [1, 3], [1, 2] < [1], 'b' > 'abc')
  1. A. True True True
  2. B. False False True
  3. C. True False False
  4. D. True False True

Correct answer: D. True False True

Lists compare item by item, so [1, 2] is less than [1, 3]. A longer list with the same prefix is larger, and 'b' is greater than 'abc' at the first character.

More Python Programming questions

Exams that ask this topic