What will be the output of the following Python code snippet? STR = "It is…

2026

What will be the output of the following Python code snippet?

STR = "It is still a test"

print(STR.split('t', 3))

  1. A.

    ['I', ' is s', 'ill a test']

  2. B.

    ['I', ' is s', 'ill a ', 'es']

  3. C.

    ['I', ' is s', 'ill a ', 'est']

  4. D.

    ['I', ' is s', 'ill a ', 'es', '']

Attempted by 87 students.

Show answer & explanation

Correct answer: C

The string is "It is still a test".
We apply split('t', 3), which means split the string at character 't' with a maximum of 3 splits.

Step-by-step splitting:
1st 't' → before it is ""
2nd 't' → gives " is s"
3rd 't' → gives "ill a "
Remaining part → "est"

Final Output:
['', ' is s', 'ill a ', 'est']

Explore the full course: Rssb Senior Computer Instructor