Which of the following is the correct output of the given Python code? STR =…
2026
Which of the following is the correct output of the given Python code?
STR = "MIRROR OF FUTURE"
print(STR.partition("OF"))
- A.
('MIRROR', 'OF', 'FUTURE')
- B.
['MIRROR', 'OF', 'FUTURE']
- C.
('MIRROR', 'FUTURE')
- D.
['MIRROR', 'FUTURE']
Attempted by 101 students.
Show answer & explanation
Correct answer: A
The partition() method splits the string at the first occurrence of the separator. It returns a tuple containing three elements: the part before the separator, the separator itself, and the part after it. For 'MIRROR OF FUTURE'.partition('OF'), the result is ('MIRROR', 'OF', 'FUTURE').