From 2c4c96e838bd29565e7f365b6bceebdd41383e3f Mon Sep 17 00:00:00 2001 From: Marege Date: Thu, 5 Nov 2026 18:37:31 +0100 Subject: [PATCH] Fix9u8 --- u8/program.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/u8/program.py b/u8/program.py index 61deab4..d5b7cbc 100644 --- a/u8/program.py +++ b/u8/program.py @@ -8,7 +8,7 @@ def main(): q = pocet_otazok(tree_lines) a = pocet_odpovedi(tree_lines) tree = build_tree(tree_lines) - if tree is None or len(tree) == 0: + if tree is None or len(tree_lines) != 0: print("Chybna databaza") return print("Pocet otazok:", q) @@ -43,6 +43,8 @@ def build_tree(tree_lines): if line.endswith("?"): node["a"] = build_tree(tree_lines) node["n"] = build_tree(tree_lines) + if node["a"] is None or node["n"] is None: + return None return node def pocet_otazok(tree_lines): @@ -66,7 +68,7 @@ def read_tree_lines(): tree_lines.append(text) text = input().rstrip("\r") except EOFError: - pass + return None return tree_lines def controla_batabaz(tree_lines):