Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- heads = 50
- tails = 50
- counter = 0
- while heads <= 83:
- heads = 0
- tails = 0
- for num in range(100):
- rand = random.randrange(3)
- if rand % 2 == 0:
- heads += 1
- else:
- tails += 1
- s = "There were {heads} heads and {tails} tails flipped out of 100.".format(heads=heads, tails=tails)
- print(s)
- counter += 1
- print("It took " + str(counter) + " runs to get a split of {heads} to {tails}.".format(heads=heads, tails=tails))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement