Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question # 5 multiple choice which method adds an element at the beginn…

Question

question # 5
multiple choice
which method adds an element at the beginning of a deque?
addleft
popleft
appendleft
insertleft

Explanation:

Brief Explanations

In Python's collections.deque (double - ended queue), the appendleft method is used to add an element to the beginning (left - hand side) of the deque. addleft is not a valid method for deque. popleft is used to remove and return the left - most element. insertleft is not a standard method for deque.

Answer:

C. appendleft