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,)