Online Exam Quiz
Menu mobile
Home
GK Today
Subject
CCC Online Test
O Level Online Test
Coding
Report Bug
Qus: <p>What will be the output of the following Python code?</p><pre><span style="font-size: 14px;">print('abcd'.partition('cd'))</span></pre>
Qus<p>निम्नलिखित पायथन कोड का आउटपुट क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">print('abcd'.partition('cd'))</span></pre>
A. (‘ab’, ‘cd’, ”)
B. (‘ab’, ‘cd’)
C. एरर
D. उल्लेखित कोई नहीं
Solution
A. (‘ab’, ‘cd’, ”)
Explanation
The partition() method in Python splits a string into three parts based on a specified separator. It returns a tuple containing three elements:
The part of the string before the first occurrence of the separator.
The separator itself.
The part of the string after the separator.
Explanation:
The first element of the tuple is 'ab', which is the part of the string before the first occurrence of 'cd'.
The second element is 'cd', which is the separator itself.
The third element is an empty string '', which is the part of the string after the separator.
So, when you print the result, you'll see ('ab', 'cd', '').
Latest Current Affairs 2026
Online Exam Quiz for One day Exam
Online Typing Test
CCC Online Test , CCC MCQ
Python Coding Tutorials
Best Computer Training Institute in Prayagraj (Allahabad)
O Level NIELIT Study material and Quiz
Website development Company in Allahabad