diff --git a/TaskE06/description.txt b/TaskE06/description.txt new file mode 100644 index 0000000..d51a6f3 --- /dev/null +++ b/TaskE06/description.txt @@ -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 diff --git a/TaskE06/run.py b/TaskE06/run.py new file mode 100644 index 0000000..3ec7a19 --- /dev/null +++ b/TaskE06/run.py @@ -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") \ No newline at end of file diff --git a/TaskE06/test.exp b/TaskE06/test.exp new file mode 100644 index 0000000..daafc65 --- /dev/null +++ b/TaskE06/test.exp @@ -0,0 +1,10 @@ +no +no +yes +yes +yes +yes +no +no +yes +yes diff --git a/TaskE06/test.in b/TaskE06/test.in new file mode 100644 index 0000000..a8331f2 --- /dev/null +++ b/TaskE06/test.in @@ -0,0 +1,10 @@ +012345 +0123456 +10000 +100001 +12345 +123456 +333333333333 +9999 +99999 +999999 diff --git a/TaskE06/test.out b/TaskE06/test.out new file mode 100644 index 0000000..daafc65 --- /dev/null +++ b/TaskE06/test.out @@ -0,0 +1,10 @@ +no +no +yes +yes +yes +yes +no +no +yes +yes diff --git a/TaskE19/description.txt b/TaskE19/description.txt new file mode 100644 index 0000000..26d0474 --- /dev/null +++ b/TaskE19/description.txt @@ -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 diff --git a/TaskE19/run.py b/TaskE19/run.py new file mode 100644 index 0000000..8134134 --- /dev/null +++ b/TaskE19/run.py @@ -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") diff --git a/TaskE19/test.exp b/TaskE19/test.exp new file mode 100644 index 0000000..889c90d --- /dev/null +++ b/TaskE19/test.exp @@ -0,0 +1,9 @@ +no +yes +no +yes +yes +yes +no +no +no diff --git a/TaskE19/test.in b/TaskE19/test.in new file mode 100644 index 0000000..de73392 --- /dev/null +++ b/TaskE19/test.in @@ -0,0 +1,9 @@ +-100 +1 +10 +100 +10000 +1000000 +1001 +2000 +500 diff --git a/TaskE19/test.out b/TaskE19/test.out new file mode 100644 index 0000000..889c90d --- /dev/null +++ b/TaskE19/test.out @@ -0,0 +1,9 @@ +no +yes +no +yes +yes +yes +no +no +no