fork(1) download
  1. a = [2, 5 ,2, 8, 5, 6, 8, 8]
  2. b = []
  3. for i in range(10):
  4. b.append(0)
  5. for i in a:
  6. t = a.count(i)
  7. b[i] = t
  8. c = []
  9. for i in b:
  10. if(i != 0):
  11. c.append(i)
  12. d =[]
  13. for i in c:
  14. e = [b.index(i),i]
  15. b[b.index(i)] = 0
  16. d.append(e)
  17. print(d)
  18.  
Success #stdin #stdout 0.1s 10088KB
stdin
Standard input is empty
stdout
[[2, 2], [5, 2], [6, 1], [8, 3]]