QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 58

What is the result of `3 == 3.0` in Python?

  1. `True`, because the numeric values are equalՃիշտ պատասխան
  2. `False` because the operand types differ
  3. A `TypeError` because Python does not auto-convert them
  4. `3.0` because the integer is converted and returned

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

Integers and floating-point numbers can compare by numeric value, and these two operands both represent three, so equality is true. Their differing exact types do not force inequality or make the comparison invalid.

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

Սկսել վարժանքը
Հարց 58: What is the result of `3 == 3.0` in Python? · Python Fundamentals · Questena