Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def two_dice(numRolls):
- outcome = []
- for index in range(11):
- outcome.append(0)
- counter = 1
- while counter <= numRolls:
- rollsum = random.randint(1,6) + random.randint(1,6)
- print("Roll number ", counter, "is -> ", rollsum)
- outcome[rollsum-2] = outcome[rollsum-2] + 1
- counter = counter + 1
- frequency = []
- for index in range(11):
- frequency.append(outcome[index]/numRolls)
- return outcome, frequency
- outcome2Dice, frequency2Dice = two_dice(10)
- print(outcome2Dice)
- print(frequency2Dice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement