Created
July 16, 2020 12:56
-
-
Save SaraM92/2e47bfff3e049f37d41d266d9da5de0f to your computer and use it in GitHub Desktop.
This file contains 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
from random import randint | |
from collections import Counter | |
#A function to genrate randome experiments | |
def gen(x): | |
expResults = [] | |
for i in range(x): | |
expResults.append(randint(1,6)) | |
return expResults | |
#An experiment with 100 events | |
event1 = dict(Counter(gen(100))) | |
for k,v in event1.items(): | |
print("probability of", k, "is",v/100) | |
print("------------------------------") | |
#An experiment with 1000 events | |
event2 = dict(Counter(gen(1000))) | |
for k,v in event2.items(): | |
print("probability of", k, "is",v/1000) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment