How to append random values to deque in Python

1 Answer

0 votes
import collections
import random

d = collections.deque()

for i in range(5):         
    d.append(random.randint(0, 100))

print(d) 



'''
run:

deque([94, 34, 75, 1, 15])

'''

 



answered May 8, 2019 by avibootz

Related questions

1 answer 195 views
1 answer 149 views
1 answer 186 views
1 answer 503 views
2 answers 189 views
189 views asked Apr 24, 2021 by avibootz
1 answer 138 views
138 views asked Aug 28, 2020 by avibootz
2 answers 185 views
...