From 9596a22275985b7487d390bbc86d398f8a888b35 Mon Sep 17 00:00:00 2001 From: KateandEva Date: Mon, 4 Nov 2019 15:31:19 +0200 Subject: [PATCH 1/2] First upload --- ParseFaculty/Faculty.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ParseFaculty/Faculty.py diff --git a/ParseFaculty/Faculty.py b/ParseFaculty/Faculty.py new file mode 100644 index 0000000..5e01778 --- /dev/null +++ b/ParseFaculty/Faculty.py @@ -0,0 +1,16 @@ +def parse_faculty(text): + """ + Функція зчитування рядка факультету та виведення у короткому вигляді + + :param text: data type: string + format: Word word word. Word + examples: Факультет прикладної математики. Денна + Факультет інформаціонної обчислювальної техніки. Заочна + :return: data type: string + format: XXX + examples: ФПМ + ФІОТ + """ + + print(text) + return None \ No newline at end of file From a7c4b63b1bdb2cb2286f3faa5b1d31765965394f Mon Sep 17 00:00:00 2001 From: KateandEva Date: Mon, 4 Nov 2019 15:50:40 +0200 Subject: [PATCH 2/2] Working function --- ParseFaculty/Faculty.py | 15 +++++++++++---- ParseFaculty/__init__.py | 0 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 ParseFaculty/__init__.py diff --git a/ParseFaculty/Faculty.py b/ParseFaculty/Faculty.py index 5e01778..b671e6d 100644 --- a/ParseFaculty/Faculty.py +++ b/ParseFaculty/Faculty.py @@ -1,3 +1,4 @@ +import string def parse_faculty(text): """ Функція зчитування рядка факультету та виведення у короткому вигляді @@ -10,7 +11,13 @@ def parse_faculty(text): format: XXX examples: ФПМ ФІОТ - """ - - print(text) - return None \ No newline at end of file + """ + words = [] + words = text.split(".") + contains = words[0].split() + letters = [] + for word in contains: + letters.append(word[0].upper()) + result = "" + result = result.join(letters) + return result \ No newline at end of file diff --git a/ParseFaculty/__init__.py b/ParseFaculty/__init__.py new file mode 100644 index 0000000..e69de29