Check sibling questions

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).

  1. Computer Science - Class 12
  2. Chapter 14 - Functions in python

About the Author

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 and Computer Science at Teachoo