How to extend deque and add elements to the right of deque with Python

1 Answer

0 votes
import collections 
  
q = collections.deque([1, 18, '27', 2, 'python', 18, 19, 18]) 

print(q) 

q.extend([4, 10, 3.14, 'c']) 

print(q) 



   
'''
run:
    
deque([1, 18, '27', 2, 'python', 18, 19, 18])
deque([1, 18, '27', 2, 'python', 18, 19, 18, 4, 10, 3.14, 'c'])
 
'''

 



answered Jul 21, 2020 by avibootz

Related questions

1 answer 151 views
1 answer 164 views
1 answer 170 views
170 views asked Jul 21, 2020 by avibootz
2 answers 254 views
...