Question 42

Which string method, out of the following will always break the string into 3 parts in Python?

  1. ABreak
  2. BPartition
  3. CMid
  4. DSplit
Show answerHide answer

Correct answer: (B) Partition

Explanation

str.partition(sep) always returns a 3-tuple: the part before the separator, the separator, and the part after it. split() can return any number of parts.

From DSSSB TGT Computer Science Practice Set 3

This is question 42 of DSSSB TGT Computer Science Practice Set 3. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.