Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Python-Quizzes | Python List Quiz | Question 10

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Find the output of the following program: 

Python3




list1 = ['physics', 'chemistry', 1997, 2000]
print (list1[1][-1])

(A)

p

(B)

y

(C)

7

(D)

2


Answer: (B)

Explanation:

In python, we can slice a list but we can also slice an element within the list if it is a string. The declaration list[x][y] will mean that ‘x’ is the index of the element within a list and ‘y’ is the index of an entity within that string.


Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Last Updated : 17 Sep, 2020
Like Article
Save Article
Similar Reads