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"))

  1. A.

    ('MIRROR', 'OF', 'FUTURE')

  2. B.

    ['MIRROR', 'OF', 'FUTURE']

  3. C.

    ('MIRROR', 'FUTURE')

  4. 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').

Explore the full course: Rssb Senior Computer Instructor