From b7ec4eb17f522b2c8989a383045028f4729a44fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sp=C3=A1=C4=8Dil?= Date: Sun, 21 Jun 2026 16:31:23 +0200 Subject: [PATCH] =?UTF-8?q?feature/hod:=20nahrazen=C3=AD=20throw=20listu?= =?UTF-8?q?=20stringem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index a1a577a..d6e531a 100644 --- a/main.py +++ b/main.py @@ -15,20 +15,25 @@ with open("hodnoty.csv", "r") as csv_file: hodnoty[key] = value -def throw(count): +def throw(count: int) -> str: count = int(count) new_throw = [] for dice in range(count): new_throw.append(str(randint(1, 6))) + new_throw = "".join(new_throw) return new_throw def show_throw(throw): - pretty_list = ", ".join(throw) + throw_temp = [] + for x in throw: + throw_temp.append(x) + + pretty_list = ", ".join(throw_temp) pretty_list += "\n" - for i in range(1, len(throw) + 1): + for i in range(1, len(throw_temp) + 1): pretty_list += "^ " pretty_list += "\n" - for i in range(1, len(throw) + 1): + for i in range(1, len(throw_temp) + 1): pretty_list += f"{i} " return pretty_list @@ -64,8 +69,7 @@ def evaluate(inp, count, throw): return data def check_value(throw): - throw_s = throw.copy() - throw_s.sort() + throw_s = sorted(throw) throw_str = "".join(throw_s) hodnota = False for h in hodnoty: