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

Which outcome follows from evaluating "cat"[-100:100]?

  1. It returns an empty string.
  2. It raises IndexError for the excessive bounds.
  3. It wraps around and returns 'tac'.
  4. It clips the bounds and returns 'cat'.الإجابة الصحيحة

الشرح

Slice bounds beyond either endpoint are clipped to the available range, so this request covers the entire string. Unlike direct indexing, an excessive slice boundary does not by itself raise IndexError or wrap around.

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

بدء التدريب
السؤال 104: Which outcome follows from evaluating "cat"[-100:100]? · Python Fundamentals · Questena