QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 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.Ճիշտ պատասխան
  3. It is a view that can edit text.
  4. It is always a one-character string.

Բացատրություն

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.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 106: When text is a string, which statement describes the value… · Python Fundamentals · Questena