Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #return results of n rolls of 2 dice
- #first 2 values in list will always be 0
- import random
- values = [0,1,2,3,4,5,6,7,8,9,10,11,12]
- def dice_roll(number_of_rolls):
- totals = [0] * 13
- for i in range(number_of_rolls):
- dice_1 = random.randint(1,6)
- dice_2 = random.randint(1,6)
- total = dice_1 + dice_2
- totals[total] = totals[total] + 1
- return totals
- print(list(enumerate(dice_roll(24))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement