soru 2
unknown
python
4 years ago
380 B
10
Indexable
import random
def flippingCoin(times):
i, head, tails = 0, 0, 0
while i < times:
side = random.randint(0,1) #0 means head, 1 means tails
if(side == 0):
head += 1
else:
tails += 1
i += 1
print('Head count: %d \nTails count: %d' % (head, tails))
flipTime = int(input("Enter flip time: "))
flippingCoin(flipTime)Editor is loading...