Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tabletop = [19, 16, 2, 19, 15, 4, 9, 5, 2, 13, 7, 5, 18, 5, 1, 5, 3, 5, 20, 3]
- dicetower = [7, 6, 2, 15, 16, 1, 8, 17, 1, 6, 4, 8, 6, 4, 8, 11, 3, 15, 6, 6, 2, 2, 8, 12, 12, 17, 2, 1, 1, 16, 1, 3, 15, 12, 1, 11, 11, 4, 1, 4, 8, 1, 5, 13, 15, 7, 17, 14, 9, 4, 5, 20, 13, 20, 1, 2, 5, 4, 3, 8, 2, 10, 6, 2, 4, 5, 14, 11, 13, 15, 19, 2, 8, 2, 1, 1, 4]
- def freq(rolls):
- results = {}
- for i in range(1, 21):
- results[i] = 0
- for roll in rolls:
- results[roll] += 1
- return results
- def analyse(rolls):
- freqs = freq(rolls)
- for roll in freqs:
- count = freqs[roll]
- print str(roll) + ": " + ("." * count) + " (" + str(count) + ")"
- print "Results by quartile:"
- print "1-5: " + str(sum([freqs[c] for c in range(1, 6)]))
- print "6-10: " + str(sum([freqs[c] for c in range(6, 11)]))
- print "11-15: " + str(sum([freqs[c] for c in range(11, 16)]))
- print "16-20: " + str(sum([freqs[c] for c in range(16, 21)]))
- # Run this and call either analyse(dicetower) or analyse(tabletop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement