From 8cc69c964bb3d1dffa7ae9296f999d9c3cd3d566 Mon Sep 17 00:00:00 2001 From: Arina Dohadailo Date: Thu, 5 Nov 2026 23:00:44 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20u8/program.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- u8/program.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/u8/program.py b/u8/program.py index a71a7b9..74edc25 100644 --- a/u8/program.py +++ b/u8/program.py @@ -13,3 +13,23 @@ answer_count = 0 def bad_database(): print("Chybna databaza") exit() +def load(): + global pos, question_count, answer_count + + if pos >= len(rows): + bad_database() + + text = rows[pos] + pos += 1 + + if text == "": + bad_database() + + if "?" == text[-1]: + question_count = question_count + 1 + left = load() + right = load() + return (text, left, right) + else: + answer_count += 1 + return (text,)