From 92b31192b3bafb64a9418cb613de95ff543c48e5 Mon Sep 17 00:00:00 2001 From: Veronika Polevara Date: Sat, 25 Nov 2023 16:08:20 +0100 Subject: [PATCH] wykonane zadania z tasku D --- TaskD03/description.txt | 6 ++++++ TaskD03/run.py | 14 ++++++++++++++ TaskD03/simple.exp | 3 +++ TaskD03/simple.in | 5 +++++ TaskD03/simple.out | 3 +++ 5 files changed, 31 insertions(+) create mode 100644 TaskD03/description.txt create mode 100644 TaskD03/run.py create mode 100644 TaskD03/simple.exp create mode 100644 TaskD03/simple.in create mode 100644 TaskD03/simple.out diff --git a/TaskD03/description.txt b/TaskD03/description.txt new file mode 100644 index 0000000..114f376 --- /dev/null +++ b/TaskD03/description.txt @@ -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 \ No newline at end of file diff --git a/TaskD03/run.py b/TaskD03/run.py new file mode 100644 index 0000000..05f6da4 --- /dev/null +++ b/TaskD03/run.py @@ -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), end='') + diff --git a/TaskD03/simple.exp b/TaskD03/simple.exp new file mode 100644 index 0000000..175c58f --- /dev/null +++ b/TaskD03/simple.exp @@ -0,0 +1,3 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +1934 r. to jakas data \ No newline at end of file diff --git a/TaskD03/simple.in b/TaskD03/simple.in new file mode 100644 index 0000000..e3a93b7 --- /dev/null +++ b/TaskD03/simple.in @@ -0,0 +1,5 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +Kiedys byl 1935 rok +1934 r. to jakas data +1934 to tez jakas data \ No newline at end of file diff --git a/TaskD03/simple.out b/TaskD03/simple.out new file mode 100644 index 0000000..175c58f --- /dev/null +++ b/TaskD03/simple.out @@ -0,0 +1,3 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +1934 r. to jakas data \ No newline at end of file