diff --git a/TaskC00/description.txt b/TaskC00/description.txt deleted file mode 100644 index 424d2c8..0000000 --- a/TaskC00/description.txt +++ /dev/null @@ -1,36 +0,0 @@ -Liczby podzielne przez 5 -======================== - -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 liczbą całkowitą -podzielną przez 5. Napis nie powinien 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 is an integer divisible by 5. -The string 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ą 0. - -Attention. The task is for students whose students id remainder of the division by 10 is 0. - -POINTS: 2 -DEADLINE: 2025-01-10 23:59 -REMAINDER: 0/10 diff --git a/TaskC00/test.exp b/TaskC00/test.exp deleted file mode 100644 index 408e922..0000000 --- a/TaskC00/test.exp +++ /dev/null @@ -1,10 +0,0 @@ -yes -yes -no -yes -no -no -yes -no -yes -no diff --git a/TaskC00/test.in b/TaskC00/test.in deleted file mode 100644 index 576dd87..0000000 --- a/TaskC00/test.in +++ /dev/null @@ -1,10 +0,0 @@ --1005 --50 --76 -0 -00 -01000 -1000 -353 -465 -@!q diff --git a/TaskC01/description.txt b/TaskC01/description.txt deleted file mode 100644 index 89e5416..0000000 --- a/TaskC01/description.txt +++ /dev/null @@ -1,35 +0,0 @@ -Liczby podzielne przez 25 -========================= - -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 dodatnią liczbą -podzielną przez 25. -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 a positive integer divisible by 25. -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ą 1. - -Attention. The task is for students whose students id remainder of the division by 10 is 1. - -POINTS: 2 -DEADLINE: 2025-01-10 23:59 -REMAINDER: 1/10 diff --git a/TaskC01/test.exp b/TaskC01/test.exp deleted file mode 100644 index 7f347d5..0000000 --- a/TaskC01/test.exp +++ /dev/null @@ -1,8 +0,0 @@ -no -yes -yes -yes -no -no -no -no diff --git a/TaskC01/test.in b/TaskC01/test.in deleted file mode 100644 index 3fb76e1..0000000 --- a/TaskC01/test.in +++ /dev/null @@ -1,8 +0,0 @@ -0 -1000 -111111125 -25 -353 -465 -@!q -x50 diff --git a/TaskC02/description.txt b/TaskC02/description.txt deleted file mode 100644 index e833723..0000000 --- a/TaskC02/description.txt +++ /dev/null @@ -1,36 +0,0 @@ -Kody pocztowe -============= - -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ć z kodu pocztowego kod miasta (2 pierwsze -cyfry). Jeśli napis nie jest kodem pocztowym, należy wypisać "". -Zakładamy, że kod pocztowy składa się z 2 cyfr, minusa i 3 cyfr. Jeśli -napis nie spełnia podanych warunków, należy wypisać "". - -For each string, extract the postal code of a city (2 first digits). -If the string is not a postal code, you should print "". -We assume that the postal code consists of 2 digits, minus character, and 3 digits. -If the string doesn't fulfill the condition, you should print "". - - -UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu -dzieli się przez 10 z resztą 2. - -Attention. The task is for students whose students id remainder of the division by 10 is 2. - -POINTS: 2 -DEADLINE: 2025-01-10 23:59 -REMAINDER: 2/10 diff --git a/TaskC02/test.exp b/TaskC02/test.exp deleted file mode 100644 index 189b4b4..0000000 --- a/TaskC02/test.exp +++ /dev/null @@ -1,6 +0,0 @@ - - -23 - -61 - diff --git a/TaskC02/test.in b/TaskC02/test.in deleted file mode 100644 index f79c5fb..0000000 --- a/TaskC02/test.in +++ /dev/null @@ -1,6 +0,0 @@ -!@#$%^& -0-333 -23-000 -61-23 -61-680 -BigFoot diff --git a/TaskC03/run.py b/TaskC03/run.py new file mode 100644 index 0000000..4732e69 --- /dev/null +++ b/TaskC03/run.py @@ -0,0 +1,11 @@ +def is_valid_nip(nip): + parts = nip.split("-") + if len(parts) == 4: + lengths = list(map(len, parts)) + return (lengths == [3, 3, 2, 2] or lengths == [3, 2, 2, 3]) and all(part.isdigit() for part in parts) + return False + +with open("test.in", "r", encoding="utf-8") as file: + for line in file: + line = line.strip() + print("yes" if is_valid_nip(line) else "no")