Post date: Feb 1, 2019 3:57:54 PM
import random as r
print(r.randint(1,6))
rolls = []
for i in range(0, 10000):
rolls.append(r.randint(1,6))
print(rolls)
for i in range(1,7):
print(i,rolls.count(i))
#This is to list all the possible combinations of rolling 2 dice
for i in range(1,7):
for j in range(1,7):
print(i,j, i + j)
rolls.clear()
#Roll the two dice 10,000 times and store in rolls list
print("Rolling two dice")
for i in range(0,78099):
a = r.randint(1,6)
b = r.randint(1,6)
rolls.append(a + b)
for i in range(2,13):
print(i, rolls.count(i), rolls.count(i) / len(rolls))