fork download
  1. from collections import defaultdict
  2.  
  3. counting = defaultdict(int)
  4. input = [1,2,1,4]
  5. for number in input:
  6. counting[number]+=1
  7.  
  8. searched = [5,4,3,1]
  9. for number in searched:
  10. print(counting[number])
Success #stdin #stdout 0.1s 10104KB
stdin
Standard input is empty
stdout
0
1
0
2