Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #598

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# write your code here
import random

import numpy as np

import matplotlib.pyplot as plt


def flip_coin() -> dict:
res_dict = {}
count_flip = 0

while count_flip < 10001:
buf_count = 0
for _ in range(10):
if random.choice([0, 1]):
buf_count += 1
res_dict_value = res_dict.get(buf_count, 0)
res_dict[buf_count] = res_dict_value + 1
count_flip += 1

for key in res_dict:
res_dict[key] = round(res_dict[key] / 100, 2)
return res_dict


def draw_gaussian_distribution_graph() -> None:
date_dict = flip_coin()
x = np.array(list(date_dict.keys()))
y = np.array(list(date_dict.values()))

plt.plot(x, y)

plt.title("Gaussian distribution")
plt.xlabel("Heads count")
plt.ylabel("Drop percentage %")

plt.show()
Loading