Q:

Write a Python program to remove all the elements of a given deque object

0

Write a Python program to remove all the elements of a given deque object. 

All Answers

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

import collections
odd_nums = (1,3,5,7,9)
odd_deque  = collections.deque(odd_nums)
print("Original Deque object with odd numbers:")
print(odd_deque)
print("Deque length: %d"%(len(odd_deque)))
odd_deque.clear()
print("Deque object after removing all numbers-")
print(odd_deque)
print("Deque length:%d"%(len(odd_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