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)

Latest Current Affairs 2024 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