From ce27e2a8ee86af2847c1156de24301f33bfbe316 Mon Sep 17 00:00:00 2001 From: Maksym Liashenko Date: Tue, 3 Nov 2026 14:34:20 +0000 Subject: [PATCH] Update u7/zootechnik.py --- u7/zootechnik.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/u7/zootechnik.py b/u7/zootechnik.py index e69de29..96b563d 100644 --- a/u7/zootechnik.py +++ b/u7/zootechnik.py @@ -0,0 +1,70 @@ + +import sys + +class Node: + def __init__(self, text): + self.text = text + self.left = None + self.right = None + +lines = sys.stdin.read().split("\n") +if lines[-1] == "": + + + + + + + + + + + + + + + + + +def main(): + lines = [] + while true; + line = input() + if line == ""; + break; + lines.append(line); + print("Expert zo zoo to vie.") + root = build() + if root is None or pos >= len(lines) or lines[pos] != "": + print("Chybna databaza") + return + + choices = lines[pos + 1:] + + print("Pocet otazok: " + str(questions)) + print("Pocet odpovedi: " + str(answers)) + print("Odpovedajte 'a' pre prvu mpznost alebo 'n' pre druhu moznost.") + + node = root + print(node.text) + i = 0 + while node.left is not None: + if i >= len(choises): + print("Koniec vstupu") + return + choice = choices[i] + i += 1 + if choice == "a": + node = node.left + elif choice == 'n': + node = node.right + else: + print("Nerozumiem") + return + print(node.text) + print("Koniec") + + + +if __name__ == "__main__": + main()