Computer Science - Class 12
Chapter 14 - Functions in python

Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?

(a) [3, 4, 5, 20, 5, 25, 1, 3]

(b) [1, 3, 3, 4, 5, 5, 20, 25]

(c) [3, 5, 20, 5, 25, 1, 3]

(d) [1, 3, 4, 5, 20, 5, 25]

 

Answer:

The pop( ) function removes the element at the position specified in the parameter. 

Here, the position mentioned is 1 and the element at position 1 is 4. 

So, 4 is removed and list1 will become [3,5,20,5,25,1,3].

So, the correct answer is (c).

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.