Advertisement
ingwey

histogram.py

May 7th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import kivy
  2. kivy.require('1.0.1')
  3.  
  4. from random import randint
  5. from kivy.app import App
  6. from kivy.uix.widget import Widget
  7. from kivy.properties import NumericProperty, ReferenceListProperty,\
  8. ObjectProperty
  9. from kivy.vector import Vector
  10. from kivy.clock import Clock
  11.  
  12. n = 0
  13. m = 0
  14. L = list()
  15.  
  16. while m <= 10:
  17. n = randint(0, 10)
  18. L.insert(m, n)
  19. m = m+1
  20.  
  21. def histogram(L):
  22. d = {}
  23. for x in L:
  24. if x in d:
  25. d[x] += 1
  26. else:
  27. d[x] = 1
  28. return d
  29.  
  30. print (L)
  31. print (histogram(L))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement