added task
This commit is contained in:
parent
ef14ec8cd3
commit
9e943f4172
7
TaskC29/run.py
Normal file
7
TaskC29/run.py
Normal file
@ -0,0 +1,7 @@
|
||||
def is_identifier(text):
|
||||
return text.isidentifier() # Встроенная функция Python проверяет идентификатор
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_identifier(line) else "no")
|
7
TaskC30/run.py
Normal file
7
TaskC30/run.py
Normal file
@ -0,0 +1,7 @@
|
||||
def is_valid_temperature(text):
|
||||
return text.isdigit() and 0 <= int(text) <= 49 or text.startswith("-") and text[1:].isdigit() and -49 <= int(text) <= -1
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_valid_temperature(line) else "no")
|
9
TaskC31/run.py
Normal file
9
TaskC31/run.py
Normal file
@ -0,0 +1,9 @@
|
||||
def has_one_vowel(text):
|
||||
vowels = "aeiou"
|
||||
count = sum(1 for c in text if c in vowels)
|
||||
return count == 1 and text.islower() and text.isalpha() # Только строчные буквы
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if has_one_vowel(line) else "no")
|
7
TaskC32/run.py
Normal file
7
TaskC32/run.py
Normal file
@ -0,0 +1,7 @@
|
||||
def is_dollar(text):
|
||||
return text.startswith("$") and text[1:].isdigit() and (text[1] != "0" or text == "$0")
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_dollar(line) else "no")
|
7
TaskC33/run.py
Normal file
7
TaskC33/run.py
Normal file
@ -0,0 +1,7 @@
|
||||
def is_dna(text):
|
||||
return text and all(c in "AGCTU" for c in text) and ("T" not in text or "U" not in text)
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_dna(line) else "no")
|
@ -1,38 +0,0 @@
|
||||
Hmmmmm
|
||||
======
|
||||
|
||||
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 to "hmmm....." - 'm'
|
||||
występuje 2 lub więcej razy, kropki są opcjonalne, ale jeśli występują
|
||||
muszą wystąpić przynajmniej 3 razy.
|
||||
Jeśli napis spełnia tak określony warunek, należy wypisać na
|
||||
standardowym wyjściu 'yes', w przeciwnym razie — 'no'.
|
||||
|
||||
For each string, if the string is "hmmm....." - 'm' occurs
|
||||
two times or more. Dots are optional, but if occur, they must
|
||||
occur at least 3 times.
|
||||
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ą 7.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 27 is 7.
|
||||
|
||||
POINTS: 3
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 7/27
|
@ -1,11 +0,0 @@
|
||||
no
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
@ -1,11 +0,0 @@
|
||||
ahmmmm.....
|
||||
hhmmm.....
|
||||
hm.....
|
||||
hmm
|
||||
hmm...
|
||||
hmmm.
|
||||
hmmm..
|
||||
hmmm....
|
||||
hmmmm......
|
||||
hmmmm.....?!
|
||||
mmm....
|
11
TaskC35/run.py
Normal file
11
TaskC35/run.py
Normal file
@ -0,0 +1,11 @@
|
||||
def is_sing(text):
|
||||
valid = {"li", "la", "lo"}
|
||||
i = 0
|
||||
while i < len(text) - 1 and text[i:i+2] in valid: # Проверяем слоги
|
||||
i += 2
|
||||
return i >= 4 and text[i:] == "!" * (len(text) - i) # Минимум 2 слога + только "!" в конце
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_sing(line) else "no")
|
10
TaskC36/run.py
Normal file
10
TaskC36/run.py
Normal file
@ -0,0 +1,10 @@
|
||||
def get_min(text):
|
||||
parts = text.split(":")
|
||||
if len(parts) == 2 and parts[0].isdigit() and parts[1].isdigit() and 0 <= int(parts[0]) <= 23 and 0 <= int(parts[1]) <= 59:
|
||||
return parts[1]
|
||||
return "<NONE>"
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print(get_min(line))
|
@ -1,37 +0,0 @@
|
||||
Numer kierunkowy
|
||||
================
|
||||
|
||||
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 wydobyć numer kierunkowy z numeru telefonu.
|
||||
Zakładamy, że numer kierunkowy jest dwucyfrowy, musi być poprzedzony zerem
|
||||
lub plusem. Pozostała część numeru to 7 cyfr zapisanych w postaci N-NNN-NNN
|
||||
bądź NNN-NN-NN. Jeśli napis nie spełnia podanych warunków, należy wypisać
|
||||
"<NONE>".
|
||||
|
||||
For each string, extract an area code from the phone number.
|
||||
We assume, that the phone number is two digits, is preceded by zero or plus.
|
||||
The rest of the phone number is 7 digits written in N-NNN-NNN
|
||||
or NNN-NN-NN form.
|
||||
If the string does not fulfill the condition, you should print "<NONE>".
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 7 z resztą 2.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 7 is 2.
|
||||
|
||||
POINTS: 2
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 2/7
|
@ -1,9 +0,0 @@
|
||||
<NONE>
|
||||
61
|
||||
61
|
||||
61
|
||||
61
|
||||
82
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
@ -1,9 +0,0 @@
|
||||
(082) 123-45-67
|
||||
+61 5-555-553
|
||||
+61 555-55-55
|
||||
061 5-555-553
|
||||
061 555-55-55
|
||||
082 123-45-67
|
||||
082 123-45-67x
|
||||
082 23-45-67
|
||||
82 123-45-67
|
@ -1,40 +0,0 @@
|
||||
Numer domu
|
||||
==========
|
||||
|
||||
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 wydobyć numer domu z adresu. Zakładamy, że adres
|
||||
składa się ze skrótu "ul.", "os." bądź "al.", z nazwy ulicy, numeru domu i
|
||||
opcjonalnego numeru mieszkania (oddzielonego od numeru domu ukośnikiem bądź
|
||||
napisem " m. "). Nazwa ulicy składa się z co najmniej 2 liter (łącznie z
|
||||
polskimi znakami), zaczyna się wielką literą. Jeśli napis nie spełnia
|
||||
podanych warunków, należy wypisać "<NONE>".
|
||||
|
||||
For each string, you should extract the building number from the address.
|
||||
We assume, that the address consists of the abbreviation "ul.", "os.' or "al."
|
||||
street name, building name, and an optional number of apartment number
|
||||
(separated from building number by a slash or " m. ". The street number
|
||||
consists of at least 2 letters (including polish letters), starting with
|
||||
the capital letter.
|
||||
If the string does not fulfill the condition, you should print "<NONE>".
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 7 z resztą 3.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 7 is 3.
|
||||
|
||||
POINTS: 2
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 3/7
|
@ -1,7 +0,0 @@
|
||||
11
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
34
|
||||
<NONE>
|
||||
7
|
@ -1,7 +0,0 @@
|
||||
al. Xa 11/34
|
||||
bla
|
||||
os. Piastów 034 m. 2
|
||||
os. Piastów 34 m. 0
|
||||
os. Piastów 34 m. 2
|
||||
osa Piastów 34 m. 2
|
||||
ul. Chochlików 7
|
8
TaskC39/run.py
Normal file
8
TaskC39/run.py
Normal file
@ -0,0 +1,8 @@
|
||||
def is_pin(text):
|
||||
return len(text) == 6 and text.isdigit() and text.count("0") <= 1
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_pin(line) else "no")
|
||||
|
@ -1,39 +0,0 @@
|
||||
Wiek człowieka
|
||||
==============
|
||||
|
||||
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 wiek człowiek,
|
||||
tzn. jest postaci typu "45 lat", przy czym dla pierwszych lat wyjątkowo -
|
||||
"1 roczek", "2 latka", "3 latka", "4 latka". Maksymalny wiek - 110 lat.
|
||||
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 string is an age of human,
|
||||
this is the form of "45 lat". For the first years, exceptionally -
|
||||
"1 roczek", "2 latka", "3 latka", "4 latka". The maximum age is 110 years.
|
||||
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 7 z resztą 5.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 7 is 5.
|
||||
|
||||
POINTS: 2
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 5/7
|
@ -1,18 +0,0 @@
|
||||
yes
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
yes
|
||||
no
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
@ -1,18 +0,0 @@
|
||||
1 roczek
|
||||
101 lat
|
||||
104 lat
|
||||
104 lata
|
||||
11 lat
|
||||
110 lat
|
||||
111 lat
|
||||
12 lat
|
||||
12 lata
|
||||
2 latka
|
||||
22 lat
|
||||
22 lata
|
||||
3 latka
|
||||
4 lata
|
||||
4 latka
|
||||
44 lata
|
||||
5 lat
|
||||
5 latek
|
11
TaskC42/run.py
Normal file
11
TaskC42/run.py
Normal file
@ -0,0 +1,11 @@
|
||||
def is_big_no(text):
|
||||
if text.startswith("NIE") and text.count("E") >= 6 and text.endswith("!!!"):
|
||||
return True
|
||||
if text.startswith("NO") and text.count("O") >= 6 and text.endswith("!!!"):
|
||||
return True
|
||||
return False
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print("yes" if is_big_no(line) else "no")
|
@ -1,44 +0,0 @@
|
||||
Mem 1
|
||||
=====
|
||||
|
||||
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 to ciąg liter
|
||||
(uwzględnić też polskie znaki) po którym następuje ciąg wykrzykników
|
||||
zamiast których może wystąpić "1", "one" albo "eleven". W napisie muszą
|
||||
pojawić się co najmniej 2 wykrzykniki, niekoniecznie obok siebie oraz co
|
||||
najmniej jedno "1", "one" lub "eleven". Zob.
|
||||
http://knowyourmeme.com/memes/the-1-phenomenon
|
||||
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 string is a sequence
|
||||
of letters (including polish letters), followed by a sequence
|
||||
of exclamation marks, instead of which, there may be
|
||||
"1", "one" or "eleven". In the string, there must be at least
|
||||
2 exclamation marks, not necessarily next to each other,
|
||||
at least one "1", "one" or "eleven". Check
|
||||
http://knowyourmeme.com/memes/the-1-phenomenon
|
||||
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 7 z resztą 1.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 7 is 1.
|
||||
|
||||
POINTS: 2
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 1/7
|
@ -1,14 +0,0 @@
|
||||
yes
|
||||
no
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
yes
|
||||
no
|
||||
yes
|
||||
no
|
||||
no
|
||||
yes
|
||||
no
|
@ -1,14 +0,0 @@
|
||||
Foo!!one!!1
|
||||
Foo!1
|
||||
Foo!1!
|
||||
Foo!one!1!eleven
|
||||
Foo!one!1eleven
|
||||
X!!1
|
||||
X!1
|
||||
Xone!!
|
||||
Ś!elevenelevenone
|
||||
Ś!elevenelevenone!
|
||||
Ś!elevenelevenoneX
|
||||
Źdź3bło!!!!!1
|
||||
Źdźbło!!!!!1
|
||||
Źdźbło!!!!!1?
|
19
TaskC44/run.py
Normal file
19
TaskC44/run.py
Normal file
@ -0,0 +1,19 @@
|
||||
def get_surname(text):
|
||||
exceptions = {"Kosma", "Jarema"}
|
||||
parts = text.split()
|
||||
|
||||
if len(parts) == 2 and parts[0][0].isupper() and parts[1][0].isupper() and len(parts[0]) >= 2 and len(
|
||||
parts[1]) >= 2:
|
||||
if parts[0].endswith("a") and parts[0] not in exceptions:
|
||||
return parts[1]
|
||||
|
||||
return "<NONE>"
|
||||
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
seen = set()
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
result = get_surname(line)
|
||||
if result not in seen or result == "<NONE>":
|
||||
seen.add(result)
|
@ -1,41 +0,0 @@
|
||||
Nazwisko męskie
|
||||
===============
|
||||
|
||||
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 wydobyć nazwisko mężczyzny z pary imię-nazwisko.
|
||||
Zakładamy, że meżczyznę identyfikujemy po imieniu zakończonym na literę
|
||||
inną niż "a" plus imiona "Kosma" i "Jarema". Imię i nazwisko składa się z
|
||||
liter (włącznie z polskimi znakami), zaczyna się wielką literą (włącznie z
|
||||
literami "Ć", "Ł", "Ś", "Ź" i "Ż"). Imię i nazwisko powinno składać się z
|
||||
przynajmniej 2 liter. Jeśli napis nie spełnia podanych warunków, należy
|
||||
wypisać "<NONE>".
|
||||
|
||||
For each string, extract the man's last name from pair first name- last name.
|
||||
We assume, that man's first name ends with all letters, but "a", except first names
|
||||
"Kosma" and "Jarema". First name and Last name consist of letters
|
||||
(including polish characters), starts with a capital letter
|
||||
(including "Ć", "Ł", "Ś", "Ź" i "Ż"). The first name and last name
|
||||
should consist of at least 2 letters.
|
||||
If the string doesn't fulfill the condition, you should print "<NONE>".
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 5 z resztą 0.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 5 is 0.
|
||||
|
||||
POINTS: 3
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 0/5
|
@ -1,14 +0,0 @@
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
Nowak
|
||||
Ścież
|
||||
Źdźbło
|
||||
<NONE>
|
||||
Xa
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
Żuraś
|
||||
<NONE>
|
@ -1,14 +0,0 @@
|
||||
Anna Kowalska
|
||||
E Xa
|
||||
Hanna Długi
|
||||
Jan Adam Nowak
|
||||
Jan Nowak
|
||||
Jarema Ścież
|
||||
Kosma Źdźbło
|
||||
Ue X
|
||||
Ue Xa
|
||||
e Xa
|
||||
jan Nowak
|
||||
Ądam Kowalski
|
||||
Łukasz Żuraś
|
||||
łukasz Żuraś
|
@ -1,43 +0,0 @@
|
||||
Wydobywanie nazwy pliku
|
||||
=======================
|
||||
|
||||
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 wydobyć nazwę pliku z pełnej ścieżki. Należy
|
||||
uwzględnić dwie konwencje - (1) linuksową (ścieżka zaczyna się ukośnikiem,
|
||||
poszczególne jej elementy też oddzielane są ukośnikiem), (2) windowsową
|
||||
(ścieżka zaczyna się od nazwy dysku - wielka litera i dwukropek, potem
|
||||
następują katalogi oddzielonę odwróconym ukośnikiem), konwencje nie mogą
|
||||
się mieszać. Jako nazwa katalogu i pliku może wystąpić dowolny niepusty
|
||||
ciąg znaków niebędących ukośnikiem ani odwróconym ukośnikiem. Jeśli napis
|
||||
nie spełnia podanych warunków, należy wypisać "<NONE>".
|
||||
|
||||
For each string extract filename from a full path.
|
||||
You should consider two conventions- (1) Linux (the path starts with
|
||||
the forward slash, elements are separated by a forward slash), (2)- windows
|
||||
(the path starts with disk name- capital letter, colon, then
|
||||
directories separated by a backward slash), conventions can not
|
||||
mix. The dir name or file name can be any non-empty
|
||||
sequence of string, which are not forward slash or backward slash.
|
||||
If the string doesn't fulfill the condition, you should print "<NONE>".
|
||||
|
||||
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
|
||||
dzieli się przez 5 z resztą 1.
|
||||
|
||||
Attention. The task is for students whose students id remainder of the division by 5 is 1.
|
||||
|
||||
POINTS: 3
|
||||
DEADLINE: 2025-01-10 23:59
|
||||
REMAINDER: 1/5
|
@ -1,13 +0,0 @@
|
||||
w--www
|
||||
Plik.txt
|
||||
<NONE>
|
||||
tuxracer
|
||||
<NONE>
|
||||
stronka.html
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
<NONE>
|
||||
bla.txt
|
||||
<NONE>
|
||||
<NONE>
|
@ -1,13 +0,0 @@
|
||||
/a/x/y/z/q/w--www
|
||||
/home/megapiranha/tajne/Plik.txt
|
||||
/usr//bin/tuxracer
|
||||
/usr/bin/tuxracer
|
||||
/usr/bin/tuxracer/
|
||||
C:\Windows\Lamer\stronka.html
|
||||
C:\Windows\Lamer\stronka.html\
|
||||
C:\Windows\\Lamer\stronka.html\
|
||||
C:\foo/bar
|
||||
Windows\Lamer\stronka.html
|
||||
X:\bla.txt
|
||||
\Windows\Lamer\stronka.html
|
||||
usr/bin/tuxracer
|
15
TaskC47/run.py
Normal file
15
TaskC47/run.py
Normal file
@ -0,0 +1,15 @@
|
||||
def get_hashtags(text):
|
||||
hashtags = []
|
||||
words = text.split()
|
||||
|
||||
for word in words:
|
||||
if word.startswith("#") and len(word) > 1 and word[1].isalpha():
|
||||
hashtags.append(word)
|
||||
|
||||
return ";".join(hashtags) if hashtags else "<NONE>"
|
||||
|
||||
|
||||
with open("test.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print(get_hashtags(line))
|
14
TaskD05/run.py
Normal file
14
TaskD05/run.py
Normal file
@ -0,0 +1,14 @@
|
||||
def replace_third(line):
|
||||
words = line.split()
|
||||
if len(words) < 3:
|
||||
return line
|
||||
punctuation = "." if words[2].endswith(".") else ""
|
||||
word_clean = words[2].rstrip(".")
|
||||
new_word = "x" * len(word_clean) + punctuation
|
||||
words[2] = new_word
|
||||
return " ".join(words)
|
||||
|
||||
with open("simple.in", "r", encoding="utf-8") as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
print(replace_third(line))
|
24
TaskG00/run.py
Normal file
24
TaskG00/run.py
Normal file
@ -0,0 +1,24 @@
|
||||
import re
|
||||
|
||||
|
||||
def load_surnames():
|
||||
file1_path = "nazwiska1.csv"
|
||||
file2_path = "nazwiska2.csv"
|
||||
|
||||
surnames = set()
|
||||
|
||||
for file_path in [file1_path, file2_path]:
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
next(file)
|
||||
for line in file:
|
||||
surname = line.split(";")[0].split(",")[0].strip().lower()
|
||||
if surname:
|
||||
surnames.add(surname)
|
||||
|
||||
return sorted(surnames)
|
||||
|
||||
|
||||
surnames = load_surnames()
|
||||
|
||||
for surname in surnames:
|
||||
print(surname)
|
22
TaskG03/run.py
Normal file
22
TaskG03/run.py
Normal file
@ -0,0 +1,22 @@
|
||||
import re
|
||||
|
||||
def load_surnames():
|
||||
file1_path = "nazwiska1.csv"
|
||||
file2_path = "nazwiska2.csv"
|
||||
|
||||
surnames = set()
|
||||
|
||||
for file_path in [file1_path, file2_path]:
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
next(file) # Пропускаем заголовок
|
||||
for line in file:
|
||||
surname = line.split(";")[0].split(",")[0].strip()
|
||||
if surname:
|
||||
surnames.add(surname) # Убираем .lower()
|
||||
|
||||
return sorted(surnames)
|
||||
|
||||
surnames = load_surnames()
|
||||
|
||||
for surname in surnames:
|
||||
print(surname)
|
Loading…
Reference in New Issue
Block a user