Created
May 21, 2015 14:37
-
-
Save myano/46325dbd706a27197b46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import random | |
dice_numbers = dict() | |
dice = range(1, 7) | |
total = 1500000 | |
for x in range(0, total): | |
temp = random.choice(dice) + random.choice(dice) | |
if temp not in dice_numbers: | |
dice_numbers[temp] = 0 | |
dice_numbers[temp] += 1 | |
print('Done!') | |
for x in range(2, 13): | |
print('%s: %s -- %.2f' % (x, dice_numbers[x], float(dice_numbers[x]) / total * 100.0) + '%') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment