How to count the occurrences of specific element in deque with Python

1 Answer

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

print(q.count(18)) 




   
'''
run:
    
4
 
'''

 



answered Jul 21, 2020 by avibootz

Related questions

...