From d366260b899a3f6468eeffe890a97900cbdad979 Mon Sep 17 00:00:00 2001 From: Daniel <59575049+lemoentjiez@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:54:52 +0200 Subject: [PATCH] Update betting.py --- LabPSA_1/betting.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/LabPSA_1/betting.py b/LabPSA_1/betting.py index f196f20..8551fbd 100644 --- a/LabPSA_1/betting.py +++ b/LabPSA_1/betting.py @@ -1,17 +1,13 @@ import random import statistics -count = 100000 results = [] -for _ in range(count): - nr_success = 0 - x = 6 - while x > 5: +for _ in range(100000): + nr_success, x = 0, 1 + while x == 1: nr_success += 1 - x = random.uniform(0, 10) + x = random.randint(0, 1) if nr_success > 1: results.append(pow(2, nr_success)) -results.sort() print(statistics.mean(results)) -