Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksVakulenko committed Dec 23, 2024
1 parent 9ece647 commit 2aa8f6d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 2aa8f6d

Please sign in to comment.