all tasks from 2 lesson, working localy

This commit is contained in:
= 2020-11-21 02:23:43 +01:00
parent 0bba71b6d4
commit 99f44bfba2
27 changed files with 127 additions and 0 deletions

0
TaskB01/Makefile Normal file
View File

2
TaskB01/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskB01/run.py "$@"

10
TaskB01/run.py Normal file
View File

@ -0,0 +1,10 @@
import re
import sys
pattern = re.compile(r"^.*(Hamlet).*$")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print(line.rstrip('\n'))

0
TaskB02/Makefile Normal file
View File

2
TaskB02/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskB02/run.py "$@"

10
TaskB02/run.py Normal file
View File

@ -0,0 +1,10 @@
import re
import sys
pattern = re.compile(r"(^.*( )[Pp]ies( ).*$)|(^[pP]ies( ).*$)|(^.*( )[pP]ies$|(^pies$))")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print(line.rstrip('\n'))

0
TaskB03/Makefile Normal file
View File

2
TaskB03/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskB03/run.py "$@"

10
TaskB03/run.py Normal file
View File

@ -0,0 +1,10 @@
import re
import sys
pattern = re.compile(r"19\d\d r\.")
text = ['< Głównymi stacjami kolejowymi powiatu są Koło i Kłodawa, które powstały w 1922 r. Położone są przy linii kolejowej nr 3: Frankfurt nad Odrą-Warszawa. Oprócz nich, na tej linii znajdują się jeszcze stacje: Budki Nowe, Barłogi i Turzynów.']
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print(line.rstrip('\n'))

0
TaskB04/Makefile Normal file
View File

2
TaskB04/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskB04/run.py "$@"

11
TaskB04/run.py Normal file
View File

@ -0,0 +1,11 @@
import re
import sys
pattern = re.compile(r"\d+")
# pattern = re.compile(r"(?<= )\d+(?= )|\d+(?= )|(^\d+$)|(?<= )\d+")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print(" ".join(x))

2
TaskC02/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskC02/run.py "$@"

12
TaskC02/run.py Normal file
View File

@ -0,0 +1,12 @@
import re
import sys
pattern = re.compile(r"[0-9]{2}-[0-9]{3}")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print(x[0][:2])
else:
print("<NONE>")

0
TaskC07/Makefile Normal file
View File

2
TaskC07/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskC07/run.py "$@"

12
TaskC07/run.py Normal file
View File

@ -0,0 +1,12 @@
import re
import sys
pattern = re.compile(r"^\*+$")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print('yes')
else:
print("no")

View File

@ -1,6 +1,8 @@
09-333-56773-4324
1-500-00000-0000
1-500-55773-4323
1-500-56773-4323
1-500-56773-4324
9-333-56773-4324

0
TaskC33/Makefile Normal file
View File

2
TaskC33/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskC33/run.py "$@"

12
TaskC33/run.py Normal file
View File

@ -0,0 +1,12 @@
import re
import sys
pattern = re.compile(r"(^((?!T)[A, G, C, U])*$)|(^((?!U)[A, G, C, T])*$)")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print('yes')
else:
print("no")

0
TaskC42/Makefile Normal file
View File

2
TaskC42/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskC42/run.py "$@"

12
TaskC42/run.py Normal file
View File

@ -0,0 +1,12 @@
import re
import sys
pattern = re.compile(r"(^N{1}I{1}E{6,}\!{3,}$)|(^N{1}O{6,}\!{3,}$)")
for line in sys.stdin:
x = re.findall(pattern, line)
if x:
print('yes')
else:
print("no")

0
TaskC47/Makefile Normal file
View File

2
TaskC47/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python TaskC47/run.py "$@"

18
TaskC47/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
import sys
pattern = re.compile(r"(#{1}(?![0-9])([A-Z]|[a-z]|\d)+)")
for line in sys.stdin:
x = re.findall(pattern, line)
output = []
for g in x:
output.append(g[0])
output_str = ";".join(output)
if not output_str:
print("<NONE>")
else:
print(output_str)