fork download
  1. # your code goes here
  2.  
  3. x = [1,2,1,2,3,5,8,4,9,4]
  4.  
  5. c = {}
  6.  
  7. for i in x:
  8. if i in c:
  9. c[i]+=1
  10. else:
  11. c[i]=1
  12.  
  13. print(c)
Success #stdin #stdout 0.07s 14072KB
stdin
Standard input is empty
stdout
{1: 2, 2: 2, 3: 1, 5: 1, 8: 1, 4: 2, 9: 1}