QuestenaPractice that shows what to review next
Question 60

What happens when Python evaluates `1 < "2"`?

  1. `True` after converting the string to an integer
  2. `False` because all strings sort before integers
  3. A `TypeError` because Python does not auto-convert themCorrect answer
  4. A stable result based on the objects' memory locations

Explanation

An integer and a string are unrelated built-in types for ordering, so Python raises `TypeError`. It does not parse the string as a number or impose a universal cross-type sort order.

Continue with this test

Start practice
Question 60: What happens when Python evaluates `1 < "2"`? · Python Fundamentals · Questena