Advertisement
Guest User

dwa

a guest
Oct 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. from main import Die
  2.  
  3. import pygal
  4. from sys import path
  5.  
  6. print(path)
  7.  
  8. die = Die()
  9.  
  10. results = []
  11. for roll_num in range(1000):
  12. result = die.roll()
  13. results.append(result)
  14.  
  15. frequencies = []
  16. for value in range (1, die.num_sides+1):
  17. frequency = results.count(value)
  18. frequencies.append(frequency)
  19.  
  20. hist = pygal.Bar()
  21. hist.force_uri_protocol = 'http'
  22.  
  23. hist.title = "Wyniki rzucania pojedynczą kością D6 tysiąc razy"
  24. hist.x_labels = ['1', '2', '3', '4', '5', '6']
  25. hist.x_title = "Wynik"
  26. hist.y_title = "Częstotliwość występowania wartości"
  27.  
  28. hist.add('D6', frequencies)
  29. hist.render_to_file('die_visual.svg')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement