QuestenaUn entraînement qui indique quoi revoir ensuite
Question 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.0Bonne réponse

Explication

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.

Continuer avec ce test

Commencer l’entraînement
Question 112: What are the exact value and type of 4 / 2 in Python? · Python Fundamentals · Questena