Compare commits
5 Commits
af19e6039d
...
e925c1d284
Author | SHA1 | Date | |
---|---|---|---|
e925c1d284 | |||
60e00a1366 | |||
|
99d7880460 | ||
|
078f633165 | ||
|
ed4c60e3ec |
5
TaskD01/description.txt
Normal file
5
TaskD01/description.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Write a program to find lines containing the word "Hamlet".
|
||||
Do use regular expressions.
|
||||
|
||||
POINTS: 1
|
||||
DEADLINE: 2023-11-26 23:59:59
|
13
TaskD01/run.py
Normal file
13
TaskD01/run.py
Normal file
@ -0,0 +1,13 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
found_lines = []
|
||||
|
||||
|
||||
for line in sys.stdin:
|
||||
if re.search(r'\bHamlet\b', line):
|
||||
found_lines.append(line.strip())
|
||||
|
||||
|
||||
if found_lines:
|
||||
print('\n'.join(found_lines))
|
2
TaskD01/simple.exp
Normal file
2
TaskD01/simple.exp
Normal file
@ -0,0 +1,2 @@
|
||||
Here comes Hamlet
|
||||
Hamlet Hamlet again
|
3
TaskD01/simple.in
Normal file
3
TaskD01/simple.in
Normal file
@ -0,0 +1,3 @@
|
||||
Here comes Hamlet
|
||||
ABC
|
||||
Hamlet Hamlet again
|
2
TaskD01/simple.out
Normal file
2
TaskD01/simple.out
Normal file
@ -0,0 +1,2 @@
|
||||
Here comes Hamlet
|
||||
Hamlet Hamlet again
|
7
TaskD02/description.txt
Normal file
7
TaskD02/description.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Write a program to find lines containing the word "pies" separated by spaces.
|
||||
The word does not need to have space on the left if it is the line beginning or space on the right if it is line ending.
|
||||
Return line no matter of word "pies" casing.
|
||||
Do use regular expressions.
|
||||
|
||||
POINTS: 1
|
||||
DEADLINE: 2023-11-26 23:59:59
|
13
TaskD02/run.py
Normal file
13
TaskD02/run.py
Normal file
@ -0,0 +1,13 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
found_lines = []
|
||||
|
||||
for line in sys.stdin:
|
||||
if re.search(r'\b\s*pies\s*\b', line, flags=re.IGNORECASE):
|
||||
found_lines.append(line.strip())
|
||||
|
||||
|
||||
if found_lines:
|
||||
print('\n'.join(found_lines))
|
||||
|
3
TaskD02/simple.exp
Normal file
3
TaskD02/simple.exp
Normal file
@ -0,0 +1,3 @@
|
||||
Pies ma Alę
|
||||
Kot i pies to zwierzęta
|
||||
pies
|
5
TaskD02/simple.in
Normal file
5
TaskD02/simple.in
Normal file
@ -0,0 +1,5 @@
|
||||
Pies ma Alę
|
||||
Ala ma psa
|
||||
tu nic nie ma
|
||||
Kot i pies to zwierzęta
|
||||
pies
|
3
TaskD02/simple.out
Normal file
3
TaskD02/simple.out
Normal file
@ -0,0 +1,3 @@
|
||||
Pies ma Alę
|
||||
Kot i pies to zwierzęta
|
||||
pies
|
6
TaskD03/description.txt
Normal file
6
TaskD03/description.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Write a program to find lines containing date from 1900 to 1999 in format '19XX r.' no matter what on the left or right of the expression.
|
||||
Note that part ' r.' is obligatory.
|
||||
Do use regular expressions.
|
||||
|
||||
POINTS: 1
|
||||
DEADLINE: 2023-11-26 23:59:59
|
14
TaskD03/run.py
Normal file
14
TaskD03/run.py
Normal file
@ -0,0 +1,14 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
found_lines = []
|
||||
|
||||
for line in sys.stdin:
|
||||
if re.search(r'\b19\d{2}\s*r\.\b|\b\W19\d{2}\s*r\.\b|\b19\d{2}\s*r\.\W', line, flags=re.IGNORECASE):
|
||||
found_lines.append(line.strip())
|
||||
|
||||
|
||||
if found_lines:
|
||||
print('\n'.join(found_lines))
|
||||
|
3
TaskD03/simple.exp
Normal file
3
TaskD03/simple.exp
Normal file
@ -0,0 +1,3 @@
|
||||
Kiedyś był 1934 r.
|
||||
Kiedyś był 1934 r.fsdfsdfsdf
|
||||
1934 r. to jakaś data
|
5
TaskD03/simple.in
Normal file
5
TaskD03/simple.in
Normal file
@ -0,0 +1,5 @@
|
||||
Kiedyś był 1934 r.
|
||||
Kiedyś był 1934 r.fsdfsdfsdf
|
||||
Kiedyś był 1935 rok
|
||||
1934 r. to jakaś data
|
||||
1934 to też jakaś data
|
3
TaskD03/simple.out
Normal file
3
TaskD03/simple.out
Normal file
@ -0,0 +1,3 @@
|
||||
Kiedyś był 1934 r.
|
||||
Kiedyś był 1934 r.fsdfsdfsdf
|
||||
1934 r. to jakaś data
|
6
TaskD04/description.txt
Normal file
6
TaskD04/description.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Write a program to find all maximum substrings of digits.
|
||||
Return only these substrings separated by spaces in their order.
|
||||
Do use regular expressions.
|
||||
|
||||
POINTS: 2
|
||||
DEADLINE: 2023-11-26 23:59:59
|
21
TaskD04/run.py
Normal file
21
TaskD04/run.py
Normal file
@ -0,0 +1,21 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
def remove_non_digits(line):
|
||||
|
||||
return re.sub(r'[^0-9\s]', '', line)
|
||||
|
||||
|
||||
processed_lines = []
|
||||
|
||||
for line in sys.stdin:
|
||||
processed_line = remove_non_digits(line)
|
||||
processed_line = re.sub(r'^\s+|\s+$', '', processed_line)
|
||||
processed_line = re.sub(r'\s+', ' ', processed_line)
|
||||
|
||||
digit_groups = re.findall(r'\d+', processed_line)
|
||||
|
||||
if digit_groups:
|
||||
processed_lines.append(' '.join(digit_groups))
|
||||
|
||||
print('\n'.join(processed_lines))
|
4
TaskD04/simple.exp
Normal file
4
TaskD04/simple.exp
Normal file
@ -0,0 +1,4 @@
|
||||
34234 34 5
|
||||
34535
|
||||
34
|
||||
1992 1999
|
5
TaskD04/simple.in
Normal file
5
TaskD04/simple.in
Normal file
@ -0,0 +1,5 @@
|
||||
34234 34 dfd gfd 5
|
||||
34535
|
||||
fsdflskfjsdflk
|
||||
fsdkfj sdf34fdfd
|
||||
Firma powstała w 1992 r., z połączenia Authorware, Inc. (twórców pakietu Authorware) i MacroMind-Paracomp (producenta Macromind Director). W 1999 r. Macromedia zakupiła firmę Allaire i jej bi
|
4
TaskD04/simple.out
Normal file
4
TaskD04/simple.out
Normal file
@ -0,0 +1,4 @@
|
||||
34234 34 5
|
||||
34535
|
||||
34
|
||||
1992 1999
|
35
TaskE06/description.txt
Normal file
35
TaskE06/description.txt
Normal file
@ -0,0 +1,35 @@
|
||||
Liczba pięcio bądź sześciocyfrowa
|
||||
=================================
|
||||
|
||||
Napisać program, który wczytuje kolejne wiersze ze standardowego
|
||||
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
|
||||
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
|
||||
użyć negacji jako operacji w danym języku programowania, jeśli da się
|
||||
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
|
||||
użyć pojedynczego wyrażenia regularnego.
|
||||
|
||||
Write a program, which loads consecutive lines from standard input
|
||||
and analyze every line (with no newline character). You should
|
||||
use regular expressions to the greatest extent possible (e.g. you
|
||||
can not use negation in the programming language if it is
|
||||
possible to express the same in regular expression). Wherever possible,
|
||||
use one regular expression.
|
||||
|
||||
Dla każdego napisu należy sprawdzić, czy napis reprezentuje liczbę pięcio-
|
||||
bądź sześciocyfrową. Liczba nie powinna zawierać zer nieznaczących.
|
||||
Jeśli napis spełnia tak określony warunek, należy wypisać na
|
||||
standardowym wyjściu 'yes', w przeciwnym razie — 'no'.
|
||||
|
||||
For each string, check if the given string represents
|
||||
5 or 6 digits number. The number should not contain leading zeros.
|
||||
If the string fulfills the condition, you should print 'yes' on the
|
||||
standard output and 'no' otherwise.
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 10 z resztą 6.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 10 is 6.
|
||||
|
||||
POINTS: 1
|
||||
DEADLINE: 2023-12-10 23:59:59
|
||||
REMAINDER: 6/10
|
19
TaskE06/run.py
Normal file
19
TaskE06/run.py
Normal file
@ -0,0 +1,19 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
def check(a):
|
||||
pattern = r'^(?!0)\d{5,6}$'
|
||||
|
||||
if re.match(pattern, a):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
for line in sys.stdin:
|
||||
word = line.strip()
|
||||
if check(word):
|
||||
print("yes")
|
||||
else:
|
||||
print("no")
|
10
TaskE06/test.exp
Normal file
10
TaskE06/test.exp
Normal file
@ -0,0 +1,10 @@
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
10
TaskE06/test.in
Normal file
10
TaskE06/test.in
Normal file
@ -0,0 +1,10 @@
|
||||
012345
|
||||
0123456
|
||||
10000
|
||||
100001
|
||||
12345
|
||||
123456
|
||||
333333333333
|
||||
9999
|
||||
99999
|
||||
999999
|
10
TaskE06/test.out
Normal file
10
TaskE06/test.out
Normal file
@ -0,0 +1,10 @@
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
35
TaskE19/description.txt
Normal file
35
TaskE19/description.txt
Normal file
@ -0,0 +1,35 @@
|
||||
Potęga setki
|
||||
============
|
||||
|
||||
Napisać program, który wczytuje kolejne wiersze ze standardowego
|
||||
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
|
||||
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
|
||||
użyć negacji jako operacji w danym języku programowania, jeśli da się
|
||||
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
|
||||
użyć pojedynczego wyrażenia regularnego.
|
||||
|
||||
Write a program, which loads consecutive lines from standard input
|
||||
and analyze every line (with no newline character). You should
|
||||
use regular expressions to the greatest extent possible (e.g. you
|
||||
can not use negation in the programming language if it is
|
||||
possible to express the same in regular expression). Wherever possible,
|
||||
use one regular expression.
|
||||
|
||||
Dla każdego napisu należy sprawdzić, czy zadany napis jest potęgą liczby
|
||||
100.
|
||||
Jeśli napis spełnia tak określony warunek, należy wypisać na
|
||||
standardowym wyjściu 'yes', w przeciwnym razie — 'no'.
|
||||
|
||||
For each string, check if the given string is the power of 100.
|
||||
If the string fulfills the condition, you should print 'yes' on the
|
||||
standard output and 'no' otherwise.
|
||||
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 27 z resztą 19.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 27 is 19.
|
||||
|
||||
POINTS: 1
|
||||
DEADLINE: 2023-12-10 23:59:59
|
||||
REMAINDER: 19/27
|
19
TaskE19/run.py
Normal file
19
TaskE19/run.py
Normal file
@ -0,0 +1,19 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
def check(a):
|
||||
pattern = r'^(?!10$)10*$'
|
||||
|
||||
if re.match(pattern, a):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
for line in sys.stdin:
|
||||
word = line.strip()
|
||||
if check(word):
|
||||
print("yes")
|
||||
else:
|
||||
print("no")
|
9
TaskE19/test.exp
Normal file
9
TaskE19/test.exp
Normal file
@ -0,0 +1,9 @@
|
||||
no
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
||||
no
|
9
TaskE19/test.in
Normal file
9
TaskE19/test.in
Normal file
@ -0,0 +1,9 @@
|
||||
-100
|
||||
1
|
||||
10
|
||||
100
|
||||
10000
|
||||
1000000
|
||||
1001
|
||||
2000
|
||||
500
|
9
TaskE19/test.out
Normal file
9
TaskE19/test.out
Normal file
@ -0,0 +1,9 @@
|
||||
no
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
||||
no
|
Loading…
Reference in New Issue
Block a user