The following Python list S is implemented as a stack. S = [10, 12, 0, 4, 6]If…

KVS TGT/PGT 2023Kendriya Vidyalaya Sangathan 2023

The following Python list S is implemented as a stack.

S = [10, 12, 0, 4, 6]

If 10 is the element added (pushed) last into the stack S, which command from the following option is best to remove (pop) an element from the Stack S, if not empty?

  1. A.

    S.pop(0)

  2. B.

    S.pop()

  3. C.

    S.remove()

  4. D.

    S.remove(0)

Attempted by 2313 students.

Sign up free to check your answer

Sign up free

Explore the full course: Hpsc Pgt Computer Science

Loading lesson…