forked from miczar1/djfz-24_25
Solve TaskA03
This commit is contained in:
parent
1204013bed
commit
cd74f9ca4c
951
TaskA03/polish_wiki_excerpt.out
Normal file
951
TaskA03/polish_wiki_excerpt.out
Normal file
File diff suppressed because one or more lines are too long
28
TaskA03/solution.py
Normal file
28
TaskA03/solution.py
Normal file
@ -0,0 +1,28 @@
|
||||
import sys
|
||||
|
||||
# return if the sentence contains word pies
|
||||
def solve(lines):
|
||||
res = []
|
||||
for l in lines:
|
||||
# first one didnt work what about the other dates?
|
||||
i = 0
|
||||
s = l
|
||||
while i != -1:
|
||||
if i+7 < len(s):
|
||||
if s[i:i+2] == "19" and s[i+2].isdigit() and s[i+3].isdigit() and s[i+4:i+7] == " r.":
|
||||
res.append(l)
|
||||
break
|
||||
i += 2 # skipping current date
|
||||
s = s[i:]
|
||||
i = s.find("19")
|
||||
return res
|
||||
|
||||
if __name__ == "__main__":
|
||||
lines = []
|
||||
|
||||
fp = sys.argv[1]
|
||||
with open("../TaskA02/polish_wiki_excerpt.in", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
sol = solve(lines)
|
||||
with open("./polish_wiki_excerpt.out", 'w', encoding="utf-8") as f:
|
||||
f.writelines(sol)
|
Loading…
Reference in New Issue
Block a user