Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 2

A program runs `count = 3` and then `count = "three"`. Which description is accurate?

  1. The second statement raises TypeError because the type changed.
  2. The name ends up referring to a string object.الإجابة الصحيحة
  3. The integer object is converted in place into text.
  4. The second statement is ignored because `count` already exists.

الشرح

The later assignment rebinds `count` from an integer object to a string object. Nothing converts the integer into text, and Python does not require a later binding to preserve the earlier object's type.

تابع هذا الاختبار

بدء التدريب
السؤال 2: A program runs `count = 3` and then `count = "three"`.… · Python Fundamentals · Questena