Compare commits

...

7 Commits

Author SHA1 Message Date
b718541d69 task2, added case with dot 2024-11-25 12:44:15 +01:00
a7892ad185 task 4 done to check 2024-11-25 12:42:37 +01:00
834f781e2c task3 done, to check 2024-11-25 12:38:21 +01:00
53e7341220 input fixed 2024-11-25 12:35:44 +01:00
956123d97e task2 done 2024-11-25 12:29:21 +01:00
348556373e task1 optimalization 2024-11-25 12:14:04 +01:00
ed65fd5535 lab2, task 1 done, 2 started 2024-11-25 12:09:17 +01:00
6 changed files with 100040 additions and 2 deletions

10
TaskB01/task1.py Normal file
View File

@ -0,0 +1,10 @@
import regex as re
with open('shakespeare.in', encoding='utf8') as file:
lines = file.readlines()
pattern = re.compile(r'Hamlet')
for line in lines:
line = line.strip()
x = re.search(pattern, line)
if x:
print(line)

10
TaskB02/task2.py Normal file
View File

@ -0,0 +1,10 @@
import regex as re
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
lines = file.readlines()
pattern = r'( |[Pp])ies(( \w+)|(\.$))'
for line in lines:
line = line.strip()
x = re.search(pattern, line)
if x:
print(line)

File diff suppressed because one or more lines are too long

10
TaskB03/task3.py Normal file
View File

@ -0,0 +1,10 @@
import re
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
lines = file.readlines()
pattern = r'19\d\d r\.'
for line in lines:
line = line.strip()
x = re.search(pattern, line)
if x:
print(line)

File diff suppressed because one or more lines are too long

10
TaskB04/task4.py Normal file
View File

@ -0,0 +1,10 @@
import re
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
lines = file.readlines()
pattern = r'\d+'
for line in lines:
line = line.strip()
x = re.findall(pattern, line)
if x:
print(' '.join(x))