निम्नलिखित कथनों का आउटपुट क्या होगा?
What will be the output of the following statements ?
list1 =[1,2,3,4,5]
print(list1[len(list1)-1])
A)
B)
C)
D)
Explanation:
The list list1
has 5 elements. len(list1) - 1
gives the index of the last element (4), which is 5
.
Answer: (A) 5