NIELIT O Level Exam

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

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 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad