View difference between Paste ID: pJEK8jkq and iUqJ05es
SHOW: | | - or go back to the newest paste.
1
import random
2-
coin = random.randint(1,2)
2+
3
heads = 0
4
tails = 0
5
6
#this is a loop, so everything in here gets re-called everytime
7
# you used to only call randint() once
8
while heads + tails != 100:
9
    coin = random.randint(1,2)
10
    print(coin)
11-
    if coin == 2:
11+
12
        heads += 1
13
14
    elif coin == 2:
15
        tails += 1
16
17
print("You flipped",heads,"heads and",tails,"tails.")