MCQ Answer

<p>what is the output of the following code?</p><pre><span style="font-size: 12.6px;">M=['b' *x for x in range(4)] print(M)</span><br></pre>

what is the output of the following code?

M=['b' *x for x in range(4)]
print(M)


निम्नलिखित कोड का आउटपुट क्या है?

M=['b' *x for x in range(4)]
print(M)
Topic : Sequence data types in python

A. ['', 'b', 'bb', 'bbb']

B. ['b,'bb', "bbb', "bbbb']

C. ['b','bb', bbb']

D. none of these इनमे से कोई नहीं




Correct Answer is :

A. ['', 'b', 'bb', 'bbb']



Explanation
<p>range(4) gives: [0, 1, 2, 3]</p><p><span style="font-size: 1rem; letter-spacing: 0.01rem;">'b' * x repeats the character 'b' x times</span></p><p><b>So:</b></p><p>'b' * 0 → ''</p><p>'b' * 1 → 'b'</p><p>'b' * 2 → 'bb'</p><p>'b' * 3 → 'bbb'</p>
Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2025 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz