From bfed68d0712ec1b40f4f5478d0e873249d186714 Mon Sep 17 00:00:00 2001 From: Bogdan Gavriluk Date: Sun, 22 Dec 2024 10:18:51 +0200 Subject: [PATCH] Solution --- app/main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index fa56336e..fdedc613 100644 --- a/app/main.py +++ b/app/main.py @@ -1 +1,11 @@ -# write your code here +import random + + +def flip_coin() -> dict: + result = {key: 0 for key in range(11)} + + for _ in range(10000): + count = sum(random.choice([0, 1]) for _ in range(10)) + result[count] += 1 + + return {key: (value / 10000) * 100 for key, value in result.items()}