U8
This commit is contained in:
parent
b6da8ca1cb
commit
6e7b2c2d2f
42
u8/program.py
Normal file
42
u8/program.py
Normal file
@ -0,0 +1,42 @@
|
||||
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():
|
||||
data = sys.stdin.read()
|
||||
raw_lines = data.split("\n")
|
||||
|
||||
lines = [] #чистимо рядочки від \r
|
||||
for l in raw_lines:
|
||||
clean_line = l.rstrip("\r")
|
||||
lines.append(clean_line)
|
||||
|
||||
tree_lines = []
|
||||
for line in lines:
|
||||
if line == "":
|
||||
break
|
||||
tree_lines.append(line)
|
||||
|
||||
print("Expert zo zoo to vie.")
|
||||
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.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in New Issue
Block a user