QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 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 themՃիշտ պատասխան
  4. A stable result based on the objects' memory locations

Բացատրություն

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.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 60: What happens when Python evaluates `1 < "2"`? · Python Fundamentals · Questena