Q:

Write a Python program to add more number of elements to a deque object from an iterable object.

0

Write a Python program to add more number of elements to a deque object from an iterable object.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import collections
even_nums = (2, 4, 6, 8, 10)
even_deque = collections.deque(even_nums)
print("Even numbers:")
print(even_deque)
more_even_nums = (12, 14, 16, 18, 20)
even_deque.extend(more_even_nums)
print("More even numbers:")
print(even_deque)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now