From 1ac3388460527ce4aba64bdbdb1dd7d4bfe5608c Mon Sep 17 00:00:00 2001 From: IlliaStrelsov <55940607+IlliaStrelsov@users.noreply.github.com> Date: Wed, 25 Dec 2019 13:50:46 +0200 Subject: [PATCH] code to review --- strelsovim/first/task1.py | 4 ++++ strelsovim/first/task2.py | 8 ++++++++ strelsovim/second/task1.py | 13 +++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 strelsovim/first/task1.py create mode 100644 strelsovim/first/task2.py create mode 100644 strelsovim/second/task1.py diff --git a/strelsovim/first/task1.py b/strelsovim/first/task1.py new file mode 100644 index 0000000..d9e4951 --- /dev/null +++ b/strelsovim/first/task1.py @@ -0,0 +1,4 @@ +x = input("Введіть елементи списку") +list + + diff --git a/strelsovim/first/task2.py b/strelsovim/first/task2.py new file mode 100644 index 0000000..8ea235a --- /dev/null +++ b/strelsovim/first/task2.py @@ -0,0 +1,8 @@ +x = input("") +list = [] +count = 0 +for i in range(length): + list[i] = input("" + str(i+1) + " ").split("") + if list[i] == []: + count +=1 +print("") diff --git a/strelsovim/second/task1.py b/strelsovim/second/task1.py new file mode 100644 index 0000000..354592c --- /dev/null +++ b/strelsovim/second/task1.py @@ -0,0 +1,13 @@ +""" +Використовуючи регулярні вирази, для поданого нижче тексту замініть кожне входження імен у форматі `Прізвище І.Б.` на імена у форматі `П.І.Б.` Виведіть результат. +""" + + +import re + +text = input("Введіть текст") + +#text = re.search(r"\w{A-z}\w{1}\w{1}""text") + +text = re.sub(r"\w{A-Z}{a-z}\w{1}.\w{1}.","\w{1}.\w{1}.\w{1}.",text) +print(text)