new
This commit is contained in:
parent
537aea64a0
commit
6937996645
@ -45,4 +45,39 @@ def main():
|
||||
a_counter = a_counter + 1
|
||||
return Node(line)
|
||||
|
||||
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()
|
||||
Loading…
Reference in New Issue
Block a user