QuestenaPractice that shows what to review next
Question 106

When text is a string, which statement describes the value produced by text[1:3] and its effect on text?

  1. It is a character list that mutates text.
  2. It is a str value, and text is unchanged.Correct answer
  3. It is a view that can edit text.
  4. It is always a one-character string.

Explanation

Slicing a string produces another string value, while the original remains unchanged because strings are immutable. A list of characters would require a separate conversion, and assigning the result to a name cannot mutate the source.

Continue with this test

Start practice
Question 106: When text is a string, which statement describes the value… · Python Fundamentals · Questena