From 7dc8eebe2892efabfd898e587d578b30af9d1b5c Mon Sep 17 00:00:00 2001 From: Daniel <59575049+lemoentjiez@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:49:47 +0200 Subject: [PATCH] Create betting.py --- LabPSA_1/betting.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 LabPSA_1/betting.py diff --git a/LabPSA_1/betting.py b/LabPSA_1/betting.py new file mode 100644 index 0000000..f196f20 --- /dev/null +++ b/LabPSA_1/betting.py @@ -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)) + +