what is the next line?\n>>> mydeque = deque(abc)\n>>> mydeque.appendleft(x)\n>>> mydeque\ndeque(x, a, b…

what is the next line?\n>>> mydeque = deque(abc)\n>>> mydeque.appendleft(x)\n>>> mydeque\ndeque(x, a, b, c)\ndeque(a, b, c, x)\nan error statement since deques do not have an appendleft method\ndeque(b, c)

what is the next line?\n>>> mydeque = deque(abc)\n>>> mydeque.appendleft(x)\n>>> mydeque\ndeque(x, a, b, c)\ndeque(a, b, c, x)\nan error statement since deques do not have an appendleft method\ndeque(b, c)

Answer

Explanation:

Step1: Understand deque operation

In Python, a deque (double - ended queue) has an appendleft method. When myDeque = deque('abc'), it creates a deque with elements 'a', 'b', 'c' in order. Then myDeque.appendleft('x') adds 'x' to the left - hand side of the deque.

Step2: Determine the resulting deque

After adding 'x' to the left of the deque with elements 'a', 'b', 'c', the new deque will have elements in the order 'x', 'a', 'b', 'c'.

Answer:

deque(['x', 'a', 'b', 'c'])