Created
August 12, 2025 17:23
-
-
Save iitalics/f69e6a68ef9766e0e35f3eb3271a885a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def simulate(): | |
| kc = 0 | |
| N = 100000 | |
| for i in range(N): | |
| n = 0 | |
| while n < 10: | |
| # roll 1 | |
| if random.randint(1, 10) == 1: | |
| n += 1 | |
| # roll 2 | |
| if random.randint(1, 10) == 1: | |
| n += 1 | |
| kc += 1 | |
| avg_kc = kc / N | |
| return avg_kc | |
| print(simulate()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment