Skip to content

Instantly share code, notes, and snippets.

@gameguy43
Last active October 3, 2019 18:39
Show Gist options
  • Save gameguy43/2c547fe784f327d092c1d5eac1779938 to your computer and use it in GitHub Desktop.
Save gameguy43/2c547fe784f327d092c1d5eac1779938 to your computer and use it in GitHub Desktop.
from collections import Counter
all_possible_results = []
for first_roll_result in range(1, 8):
for second_roll_result in range(1, 8):
for third_roll_result in range(1, 8):
for fourth_roll_result in range(1, 8):
for fifth_roll_result in range(1, 8):
result = (first_roll_result +
second_roll_result +
third_roll_result +
fourth_roll_result +
fifth_roll_result) % 5 + 1
all_possible_results.append(result)
counter = Counter(all_possible_results)
print(counter) # Counter({3: 3365, 4: 3365, 2: 3360, 5: 3360, 1: 3357})
print(len(all_possible_results) / 5) # 3361.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment