From 6937996645eaf1509669a58e83ba32baad50744e Mon Sep 17 00:00:00 2001 From: va270fv Date: Fri, 6 Nov 2026 10:40:03 +0000 Subject: [PATCH] new --- u8/program.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/u8/program.py b/u8/program.py index c379d39..2665718 100644 --- a/u8/program.py +++ b/u8/program.py @@ -45,4 +45,39 @@ def main(): a_counter = a_counter + 1 return Node(line) - \ No newline at end of file + root = parse_tree() + + if root is None or idx >= len(lines) or lines[idx] != "": + print("Chybna databaza") + return + + + print(f"Pocet otazok: {q_counter}") + print(f"Pocet odpovedi: {a_counter}") + print("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.") + + idx += 1 + + + current = root + while True: + print(current.text) + if not current.text.endswith('?'): + print("Koniec") + break + if idx >= len(lines): + print("Koniec vstupu") + break + choice = lines[idx] + idx = idx + 1 + + if choice == 'a': + current = current.left + elif choice == 'n': + current = current.right + else: + print("Nerozumiem") + break + +if __name__ == '__main__': + main() \ No newline at end of file