Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # dice
- from random import randint
- def roll():
- dice_roll1 = randint(2,6)
- dice_roll2 = randint(2,6)
- dice_roll = dice_roll1 + dice_roll2
- return dice_roll
- def times(dice_roll):
- rolls [dice_roll] += 1
- return dice_roll
- rolls=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- n = 0
- while n < 20:
- dice_roll = times(roll())
- n += 1
- print("With 20 rolls")
- print("2 came up", rolls[2], "times")
- print("3 came up", rolls[3], "times")
- print("4 came up", rolls[4], "times")
- print("5 came up", rolls[5], "times")
- print("6 came up", rolls[6], "times")
- print("7 came up", rolls[7], "times")
- print("8 came up", rolls[8], "times")
- print("9 came up", rolls[9], "times")
- print("10 came up", rolls[10], "times")
- print("11 came up", rolls[11], "times")
- print("12 came up", rolls[12], "times")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement