42 lines
917 B
Python
42 lines
917 B
Python
import sys
|
|
|
|
|
|
def pocet_otazok(tree_lines):
|
|
a = 0
|
|
for line in tree_lines:
|
|
if line.endswith("?"):
|
|
a += 1
|
|
return a
|
|
|
|
|
|
def pocet_odpovedi(tree_lines):
|
|
a = 0
|
|
for line in tree_lines:
|
|
if not line.endswith("?"):
|
|
a += 1
|
|
return a
|
|
|
|
|
|
def main():
|
|
print("Expert zo zoo to vie.")
|
|
tree_lines = read_tree_lines()
|
|
if tree_lines is None or len(tree_lines) == 0:
|
|
print("Chybna databaza")
|
|
return
|
|
print("Pocet otazok:", pocet_otazok(tree_lines))
|
|
print("Pocet odpovedi:", pocet_odpovedi(tree_lines))
|
|
print("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.")
|
|
print(tree_lines[0])
|
|
print("Koniec")
|
|
|
|
|
|
def read_tree_lines():
|
|
tree_lines = []
|
|
text = input().rstrip("\r")
|
|
while text:
|
|
tree_lines.append(text)
|
|
text = input().rstrip("\r")
|
|
return tree_lines
|
|
|
|
if __name__ == "__main__":
|
|
main() |