NIELIT O Level Exam

<p>What will be the output of the following code?</p><pre><span style="font-size: 14px;">list1=[2,33,222,14,25]<br></span><span style="font-size: 14px;">print(list1[-1])</span></pre>

What will be the output of the following code?

list1=[2,33,222,14,25]
print(list1[-1])


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

list1=[2,33,222,14,25]
print(list1[-1])

A. 2

B. 33

C. 14

D. 25




Correct Answer is :

D. 25



Explanation

in python list index start with 0 1 2 and the reverse index start from -1, -2 so on (from the end of list) so list1[-1] return the first element from right of list (last element from left)

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad