From 890c96ae521ccec8c9244bdaedb5eb38fcde2e76 Mon Sep 17 00:00:00 2001 From: Maks Vakulenko Date: Mon, 23 Dec 2024 21:26:24 +0100 Subject: [PATCH 1/3] solution --- app/main.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index fa56336e..8ba808b0 100644 --- a/app/main.py +++ b/app/main.py @@ -1 +1,26 @@ -# write your code here +import matplotlib.pyplot as plt +import random + + +def flip_coin() -> dict: + result = {i: 0.0 for i in range(11)} + for _ in range(10000): + flip_res = [random.choice([0, 1]) for _ in range(10)] + head = sum(flip_res) + result[head] += 1 + + for key in result: + result[key] = round((result[key] / 10000) * 100, 2) + + return result + + +def draw_gaussian_distribution_graph(result: dict) -> None: + x_ = list(result.keys()) + y_ = list(result.values()) + + plt.plot(x_, y_) + plt.title("Gaussian Distribution") + plt.xlabel("Heads count") + plt.ylabel("Drop percentage") + plt.show() From 22faf1c9c5873662262ee425c90bd1cb47151750 Mon Sep 17 00:00:00 2001 From: Maks Vakulenko Date: Mon, 23 Dec 2024 21:30:12 +0100 Subject: [PATCH 2/3] solution --- requirements.txt | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3f202d6e..00000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -flake8==5.0.4 -flake8-annotations==2.9.1 -flake8-quotes==3.3.1 -flake8-variables-names==0.0.5 -pep8-naming==0.13.2 -pytest==7.1.3 From cdb29ee950cbd299f3cbe4cf612dc9b0db267d69 Mon Sep 17 00:00:00 2001 From: Maks Vakulenko Date: Mon, 23 Dec 2024 21:35:46 +0100 Subject: [PATCH 3/3] solution --- app/requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/requirements.txt diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 00000000..afff6807 --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,6 @@ +flake8==5.0.4 +flake8-annotations==2.9.1 +flake8-quotes==3.3.1 +flake8-variables-names==0.0.5 +pep8-naming==0.13.2 +pytest==7.1.3 \ No newline at end of file