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