diff --git a/TaskD02/description.txt b/TaskD02/description.txt new file mode 100644 index 0000000..d10a828 --- /dev/null +++ b/TaskD02/description.txt @@ -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 \ No newline at end of file diff --git a/TaskD02/run.py b/TaskD02/run.py new file mode 100644 index 0000000..8128990 --- /dev/null +++ b/TaskD02/run.py @@ -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), end='') + diff --git a/TaskD02/simple.exp b/TaskD02/simple.exp new file mode 100644 index 0000000..caa7f93 --- /dev/null +++ b/TaskD02/simple.exp @@ -0,0 +1,3 @@ +Pies ma Ale +Kot i pies to zwierzeta +pies \ No newline at end of file diff --git a/TaskD02/simple.in b/TaskD02/simple.in new file mode 100644 index 0000000..cbf2ba9 --- /dev/null +++ b/TaskD02/simple.in @@ -0,0 +1,5 @@ +Pies ma Ale +Ala ma psa +tu nic nie ma +Kot i pies to zwierzeta +pies \ No newline at end of file diff --git a/TaskD02/simple.out b/TaskD02/simple.out new file mode 100644 index 0000000..caa7f93 --- /dev/null +++ b/TaskD02/simple.out @@ -0,0 +1,3 @@ +Pies ma Ale +Kot i pies to zwierzeta +pies \ No newline at end of file