From dadf179991444ff971c200dd6439d4b888764413 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 7 Nov 2020 20:40:04 +0100 Subject: [PATCH] test A01 --- TaskA01/Makefile | 0 TaskA01/run | 2 ++ TaskA01/run.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 TaskA01/Makefile create mode 100644 TaskA01/run create mode 100644 TaskA01/run.py diff --git a/TaskA01/Makefile b/TaskA01/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/TaskA01/run b/TaskA01/run new file mode 100644 index 0000000..fb1f6fc --- /dev/null +++ b/TaskA01/run @@ -0,0 +1,2 @@ +#!/bin/bash +python TaskA01/run.py "$@" \ No newline at end of file diff --git a/TaskA01/run.py b/TaskA01/run.py new file mode 100644 index 0000000..5ec42e0 --- /dev/null +++ b/TaskA01/run.py @@ -0,0 +1,17 @@ +import sys + + +def is_hamlet_in_line(line): + if 'Hamlet' in line: + return True + else: + return False + + +file1 = open("shakespeare.res", "a") + + +for line in sys.stdin: + if is_hamlet_in_line(line): + file1.write(line) + print(line.rstrip('\n')) \ No newline at end of file