Create betting.py
This commit is contained in:
17
LabPSA_1/betting.py
Normal file
17
LabPSA_1/betting.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
count = 100000
|
||||||
|
results = []
|
||||||
|
for _ in range(count):
|
||||||
|
nr_success = 0
|
||||||
|
x = 6
|
||||||
|
while x > 5:
|
||||||
|
nr_success += 1
|
||||||
|
x = random.uniform(0, 10)
|
||||||
|
if nr_success > 1:
|
||||||
|
results.append(pow(2, nr_success))
|
||||||
|
results.sort()
|
||||||
|
print(statistics.mean(results))
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user