Question #244

What is the output of the code snippet below?
from collections import deque
my_deque = deque([1, 2, 3, 4, 5, 6])
my_deque.rotate(3)
print(my_deque)

The rotate() method of the collections.deque class rotates the sequence present in the deque object n times. When n is positive, the rotation happens to the right, when n is negative, the rotation happens to the left. (pythontic.com/containers/deque/rotate)


Comment on Disqus:

Question difficulty: 🔵🔵🔵🔵🔵