Which string method, out of the following, will always break the string into 3…
2023
Which string method, out of the following, will always break the string into 3 parts in Python?
- A.
break
- B.
partition
- C.
mid
- D.
split
Attempted by 1481 students.
Show answer & explanation
Correct answer: B
Key idea: The partition() method always returns three parts: the part before the separator, the separator itself, and the part after it. Example: 'hello-world'.partition('-')
A video solution is available for this question — log in and enroll to watch it.