programming-examples/python/Math/Flip a coin 1000 times and count heads and tails.py
2019-11-15 12:59:38 +01:00

14 lines
279 B
Python

import random
import itertools
results = {
'heads': 0,
'tails': 0,
}
sides = list(results.keys())
for i in range(10000):
results[random.choice(sides)] += 1
print('Heads:', results['heads'])
print('Tails:', results['tails'])