NIELIT O Level Exam

<p>What will be the output of the following Python code?</p> <pre class="de1" style="border-radius: 0px; padding: 0px; font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" color:="" rgb(51,="" 51,="" 51);="" word-break:="" break-all;="" overflow-wrap:="" normal;="" background:="" rgb(244,="" 244,="" 244);="" border:="" 0px;="" overflow:="" visible;="" box-shadow:="" none;="" text-align:="" justify;="" margin-top:="" 0px="" !important;="" margin-bottom:="" line-height:="" 20px="" !important;"=""><span style="font-size: 12.6px;">a=[13,56,17] a.append([87]) a.extend([45,67]) print(a)</span><br></pre><p style="border-radius: 0px; padding: 0px;"><br></p>

What will be the output of the following Python code?

a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)



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

a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)

A. [13, 56, 17, [87], 45, 67]

B. [13, 56, 17, 87, 45, 67]

C. [13, 56, 17, 87,[ 45, 67]]

D. [13, 56, 17, [87], [45, 67]]




Correct Answer is :

A. [13, 56, 17, [87], 45, 67]



Explanation
The append function simply adds its arguments to the list as it is while extend function extends its arguments and later appends it.
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