-
-
Save s16h/b4c2bc791880b61418b2 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
import random | |
def dice_roll(): | |
return random.randint(1,6) | |
count = int(input("Enter the number of rolls: ")) | |
number_of_double_dice = 0 | |
results = [0 for x in range(13)] | |
for i in range(0,count): | |
first = dice_roll() | |
second = dice_roll() | |
sum = first + second | |
if(first == second): | |
number_of_double_dice = number_of_double_dice + 1 | |
results[sum] = results[sum] + 1 | |
for x in range (2,13): | |
print("{0:d} - {1:d} {2:0.4f}%".format(x, results[x], fesults[x])/ount*100)) | |
print("Doubles- {0:d}-{1:0.6f}%".format(number_of_double_dice, number_of_double_dice/count*100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment