QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 102

Given text = "abc", what happens when Python evaluates text[::0]?

  1. It returns an empty string.
  2. It raises ValueError.Ճիշտ պատասխան
  3. It repeats the first character forever.
  4. It returns the original string.

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

A slice step describes movement between selected positions, and zero cannot advance in either direction, so Python raises ValueError. It does not interpret zero as a request for an empty result or an endless repetition.

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

Սկսել վարժանքը
Հարց 102: Given text = "abc", what happens when Python evaluates… · Python Fundamentals · Questena