QuestenaПрактика, после которой понятно, что повторить
Вопрос 112

What are the exact value and type of 4 / 2 in Python?

  1. int 2
  2. int 0
  3. float 2.5
  4. float 2.0Правильный ответ

Объяснение

The slash performs true division, so integer operands still produce the floating-point value 2.0. An exact whole-number quotient does not cause Python to switch the result back to int.

Продолжить работу с тестом

Начать тренировку
Вопрос 112: What are the exact value and type of 4 / 2 in Python? · Python Fundamentals · Questena