From 9cf5ffa339a5b5152290f36443563df489d89531 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Sat, 14 Feb 2026 12:29:33 +0300 Subject: [PATCH 1/9] =?UTF-8?q?[0]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20main.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/main.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 skorohodovsa/main.py diff --git a/skorohodovsa/main.py b/skorohodovsa/main.py new file mode 100644 index 0000000..ba8db40 --- /dev/null +++ b/skorohodovsa/main.py @@ -0,0 +1,4 @@ +from math import sin + +for i in range(10000): + print(" " * round(50 * (1 + sin(i/100))), "Hello World!") From ae9b2a46b6cdbdc91f763b6f7894bf00127c0c8a Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:40:42 +0300 Subject: [PATCH 2/9] =?UTF-8?q?[1]=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D1=83?= =?UTF-8?q?=D0=B7=D0=BB=D0=B0=20create=5Fnode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/task_1/linked_list.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 skorohodovsa/task_1/linked_list.py diff --git a/skorohodovsa/task_1/linked_list.py b/skorohodovsa/task_1/linked_list.py new file mode 100644 index 0000000..7351f7e --- /dev/null +++ b/skorohodovsa/task_1/linked_list.py @@ -0,0 +1,13 @@ + + +def create_node( + name: str, + phone: str, + next: dict = None +): + return { + 'name': name, + 'phone': phone, + 'next': next + } + \ No newline at end of file From 1fd05fbf2549f08b481b193c11e40ab59dfda4ba Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:00:04 +0300 Subject: [PATCH 3/9] =?UTF-8?q?[1]=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81=D0=B2?= =?UTF-8?q?=D1=8F=D0=B7=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D1=83=20=D1=81=D0=BB=D0=BE=D0=B2=D0=B0=D1=80=D0=B5?= =?UTF-8?q?=D0=B9=20create=5Flinked=5Flist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/task_1/linked_list.py | 45 ++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/skorohodovsa/task_1/linked_list.py b/skorohodovsa/task_1/linked_list.py index 7351f7e..d7caab6 100644 --- a/skorohodovsa/task_1/linked_list.py +++ b/skorohodovsa/task_1/linked_list.py @@ -1,13 +1,36 @@ +def create_node(name: str, phone: str, next: dict = None): + return {"name": name, "phone": phone, "next": next} -def create_node( - name: str, - phone: str, - next: dict = None -): - return { - 'name': name, - 'phone': phone, - 'next': next - } - \ No newline at end of file +def create_linked_list(data: list[dict]) -> dict: + if data is None or len(data) == 0: + raise ValueError("Список пустой!") + + base = create_node(**data[0]) + + current = base + for value in data[1:]: + current['next'] = create_node(**value) + current = current['next'] + + return base + + +def ll_insert(): + pass + + +def ll_find(): + pass + + +def ll_delete(): + pass + + +def ll_list_all(): + pass + + +def ll_print_all(): + pass \ No newline at end of file From 7c9a1f8b51fec6203f587ef87659fcaee5288241 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:00:38 +0300 Subject: [PATCH 4/9] =?UTF-8?q?[1]=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B2=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D1=81=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/task_1/test_linked_list.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 skorohodovsa/task_1/test_linked_list.py diff --git a/skorohodovsa/task_1/test_linked_list.py b/skorohodovsa/task_1/test_linked_list.py new file mode 100644 index 0000000..d11ac57 --- /dev/null +++ b/skorohodovsa/task_1/test_linked_list.py @@ -0,0 +1,26 @@ +from linked_list import create_node, create_linked_list + + +test_records = [ + {"name": "Анна", "phone": "89123456789"}, + {"name": "Михаил", "phone": "79223334455"}, + {"name": "Елена", "phone": "4951234567"}, + {"name": "Дмитрий", "phone": "9111112233"}, + {"name": "Ольга", "phone": "81234567890"}, + {"name": "Александр", "phone": "9219998877"}, + {"name": "Татьяна", "phone": "4955556666"}, + {"name": "Иван", "phone": "9034443322"}, + {"name": "Наталья", "phone": "9167778899"}, + {"name": "Павел", "phone": "9256665544"}, + {"name": "Мария", "phone": "4953332211"}, + {"name": "Андрей", "phone": "9264443322"}, + {"name": "Екатерина", "phone": "8125554433"}, + {"name": "Владимир", "phone": "9107778899"}, + {"name": "Юлия", "phone": "4951112233"}, + {"name": "Николай", "phone": "9215556677"}, + {"name": "Светлана", "phone": "9164443322"}, + {"name": "Артем", "phone": "9253334455"}, + {"name": "Ксения", "phone": "4952223344"}, +] + +print(create_linked_list(test_records)) From 88bcf8a761a115ead9a366ff1de09b7b28cb2ab3 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Fri, 6 Mar 2026 09:55:45 +0300 Subject: [PATCH 5/9] =?UTF-8?q?[1]=20=D0=9D=D0=B0=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/task_1/linked_list.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skorohodovsa/task_1/linked_list.py b/skorohodovsa/task_1/linked_list.py index d7caab6..b1fe2d3 100644 --- a/skorohodovsa/task_1/linked_list.py +++ b/skorohodovsa/task_1/linked_list.py @@ -12,7 +12,7 @@ def create_linked_list(data: list[dict]) -> dict: for value in data[1:]: current['next'] = create_node(**value) current = current['next'] - + return base @@ -20,8 +20,15 @@ def ll_insert(): pass -def ll_find(): - pass +def ll_find(head: dict, name: str) -> str | None: + if head is None: + raise ValueError("Словарь пустой!") + + current = head + while current['next'] is not None: + if current['name'] == name: + return current['name'] + return None def ll_delete(): From de73e9247bf4942dd635faebc7867f9887e88850 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 18 Mar 2026 13:33:50 +0300 Subject: [PATCH 6/9] =?UTF-8?q?[1]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 skorohodovsa/.gitignore diff --git a/skorohodovsa/.gitignore b/skorohodovsa/.gitignore new file mode 100644 index 0000000..61b51ed --- /dev/null +++ b/skorohodovsa/.gitignore @@ -0,0 +1,2 @@ +/.ruff_check +/.vscode \ No newline at end of file From dc7f07b42b7b684c19dd1fe62f0ce6466bc83e28 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 18 Mar 2026 13:49:02 +0300 Subject: [PATCH 7/9] =?UTF-8?q?[1]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Сделана ll_insert - Редактирована ll_find - Сделана ll_delete - Сделана ll_list_all Тесты: - Для create_linked_list - Для ll_find - Для ll_insert --- skorohodovsa/task_1/linked_list.py | 72 +++++++++++---- skorohodovsa/task_1/test/test_task_1.py | 114 ++++++++++++++++++++++++ skorohodovsa/task_1/test_linked_list.py | 26 ------ 3 files changed, 169 insertions(+), 43 deletions(-) create mode 100644 skorohodovsa/task_1/test/test_task_1.py delete mode 100644 skorohodovsa/task_1/test_linked_list.py diff --git a/skorohodovsa/task_1/linked_list.py b/skorohodovsa/task_1/linked_list.py index b1fe2d3..9248ec7 100644 --- a/skorohodovsa/task_1/linked_list.py +++ b/skorohodovsa/task_1/linked_list.py @@ -3,41 +3,79 @@ def create_node(name: str, phone: str, next: dict = None): def create_linked_list(data: list[dict]) -> dict: + """Создание связного списка по массиву словарей. + + :param data: Список словарей с параметрами: {'name': str, 'phone': str, next: dict | None} + :type data: list[dict] + :raises ValueError: Ошибка при подаче на вход пустого списка + :return: Связный список оформленный по примеру: {'name': str, 'phone': str, next: dict | None} + :rtype: dict + """ if data is None or len(data) == 0: raise ValueError("Список пустой!") - + base = create_node(**data[0]) current = base for value in data[1:]: - current['next'] = create_node(**value) - current = current['next'] - + current["next"] = create_node(**value) + current = current["next"] + return base -def ll_insert(): - pass +def ll_insert(head: dict, name: str, phone: str) -> dict: + if head is None: + raise ValueError("Словарь пустой!") + + current = head + while current["next"] is not None: + if current.get("name") == name or current.get("phone") == phone: + current["name"] = name + current["phone"] = phone + break + current = current.get("next") + else: + current["next"] = {"name": name, "phone": phone, "next": None} + + return head def ll_find(head: dict, name: str) -> str | None: if head is None: raise ValueError("Словарь пустой!") - + current = head - while current['next'] is not None: - if current['name'] == name: - return current['name'] + while current is not None: + if current["name"] == name: + return current["phone"] + current = current["next"] return None -def ll_delete(): - pass +def ll_delete(head: dict, name: str) -> dict: + if head is None: + raise ValueError("Словарь пустой!") + + if head.get("name") == name: + head = head.get("next") + return head + + current = head + while current.get("next") is not None: + if current.get("next").get("name") == name: + current["next"] = current.get("next").get("next") + return head + current = current.get("next") + + return head -def ll_list_all(): - pass +def ll_list_all(head: dict) -> list: + result = [] + current = head + while current is not None: + result.append({"name": current.get("name"), "phone": current.get("phone")}) + current = current.get("next") + return result - -def ll_print_all(): - pass \ No newline at end of file diff --git a/skorohodovsa/task_1/test/test_task_1.py b/skorohodovsa/task_1/test/test_task_1.py new file mode 100644 index 0000000..d0cb728 --- /dev/null +++ b/skorohodovsa/task_1/test/test_task_1.py @@ -0,0 +1,114 @@ +import pytest +import sys +import os +import copy + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) + +from linked_list import create_linked_list, ll_find, ll_insert, ll_list_all + + +@pytest.fixture +def test_records(): + return [ + {"name": "Анна", "phone": "89123456789"}, + {"name": "Михаил", "phone": "79223334455"}, + {"name": "Елена", "phone": "4951234567"}, + {"name": "Дмитрий", "phone": "9111112233"}, + {"name": "Ольга", "phone": "81234567890"}, + {"name": "Александр", "phone": "9219998877"}, + {"name": "Татьяна", "phone": "4955556666"}, + {"name": "Иван", "phone": "9034443322"}, + {"name": "Наталья", "phone": "9167778899"}, + {"name": "Павел", "phone": "9256665544"}, + {"name": "Мария", "phone": "4953332211"}, + {"name": "Андрей", "phone": "9264443322"}, + {"name": "Екатерина", "phone": "8125554433"}, + {"name": "Владимир", "phone": "9107778899"}, + {"name": "Юлия", "phone": "4951112233"}, + {"name": "Николай", "phone": "9215556677"}, + {"name": "Светлана", "phone": "9164443322"}, + {"name": "Артем", "phone": "9253334455"}, + {"name": "Ксения", "phone": "4952223344"}, + ] + + +@pytest.fixture +def linked_list(test_records): + return create_linked_list(test_records) + + +def test_create_linked_list(test_records): + linked_list = create_linked_list(test_records) + assert linked_list is not None + + temp = linked_list + index = 0 + + while temp.get("next") is not None: + assert temp.get("phone") == test_records[index].get("phone") + assert temp.get("name") == test_records[index].get("name") + + temp = temp.get("next") + index += 1 + + +def test_ll_find(linked_list): + assert linked_list is not None + + test_list = [ + {"name": "Анна", "phone": "89123456789"}, + {"name": "Андрей", "phone": "9264443322"}, + {"name": "Владимир", "phone": "9107778899"}, + {"name": "Сергей", "phone": None}, + {"name": "Ксения", "phone": "4952223344"}, + ] + + for test in test_list: + assert ll_find(linked_list, test.get("name")) == test.get("phone") + + +def test_ll_insert_edit(linked_list, test_records): + assert linked_list is not None + + test_list = [ + {"name": "Анна", "phone": "89123456745"}, + {"name": "Андрей", "phone": "926444332232"}, + {"name": "Владимир", "phone": "9107778899"}, + {"name": "Ксения", "phone": "4952223344"}, + ] + + for test in test_list: + test_ll = copy.deepcopy(linked_list) + result_insert = ll_insert(test_ll, test.get("name"), test.get("phone")) + + # Проверяем наличие изменения номера телефона + assert ll_find(result_insert, test.get("name")) == test.get("phone") + + # Проверяем правильность места изменения + for i, value in enumerate(test_records): + if value.get("name") == test.get("name"): + assert ll_list_all(result_insert)[i].get("phone") == test.get("phone") + break + + +def test_ll_insert_new(linked_list): + assert linked_list is not None + + new_name = "Новый контакт" + new_phone = "99999999999" + + test_ll = copy.deepcopy(linked_list) + + result = ll_insert(test_ll, new_name, new_phone) + + assert ll_find(result, new_name) == new_phone + + # Проверяем, что новый элемент в конце + all_items = ll_list_all(result) + assert all_items[-1].get("name") == new_name + +def test_ll_delete(linked_list): + assert linked_list is not None + + \ No newline at end of file diff --git a/skorohodovsa/task_1/test_linked_list.py b/skorohodovsa/task_1/test_linked_list.py deleted file mode 100644 index d11ac57..0000000 --- a/skorohodovsa/task_1/test_linked_list.py +++ /dev/null @@ -1,26 +0,0 @@ -from linked_list import create_node, create_linked_list - - -test_records = [ - {"name": "Анна", "phone": "89123456789"}, - {"name": "Михаил", "phone": "79223334455"}, - {"name": "Елена", "phone": "4951234567"}, - {"name": "Дмитрий", "phone": "9111112233"}, - {"name": "Ольга", "phone": "81234567890"}, - {"name": "Александр", "phone": "9219998877"}, - {"name": "Татьяна", "phone": "4955556666"}, - {"name": "Иван", "phone": "9034443322"}, - {"name": "Наталья", "phone": "9167778899"}, - {"name": "Павел", "phone": "9256665544"}, - {"name": "Мария", "phone": "4953332211"}, - {"name": "Андрей", "phone": "9264443322"}, - {"name": "Екатерина", "phone": "8125554433"}, - {"name": "Владимир", "phone": "9107778899"}, - {"name": "Юлия", "phone": "4951112233"}, - {"name": "Николай", "phone": "9215556677"}, - {"name": "Светлана", "phone": "9164443322"}, - {"name": "Артем", "phone": "9253334455"}, - {"name": "Ксения", "phone": "4952223344"}, -] - -print(create_linked_list(test_records)) From e590e7d02def294167c7355078aa1eb7fb1e65e3 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:17:11 +0300 Subject: [PATCH 8/9] =?UTF-8?q?[1]=20=D0=94=D0=BE=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D1=8B=D1=85=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Добавлен тест ll_delete --- skorohodovsa/task_1/test/test_task_1.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/skorohodovsa/task_1/test/test_task_1.py b/skorohodovsa/task_1/test/test_task_1.py index d0cb728..f4780e6 100644 --- a/skorohodovsa/task_1/test/test_task_1.py +++ b/skorohodovsa/task_1/test/test_task_1.py @@ -5,7 +5,7 @@ import copy sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) -from linked_list import create_linked_list, ll_find, ll_insert, ll_list_all +from linked_list import create_linked_list, ll_find, ll_insert, ll_list_all, ll_delete @pytest.fixture @@ -108,7 +108,21 @@ def test_ll_insert_new(linked_list): all_items = ll_list_all(result) assert all_items[-1].get("name") == new_name -def test_ll_delete(linked_list): +def test_ll_delete(linked_list, test_records): assert linked_list is not None - \ No newline at end of file + tests = [ + test_records[0], + test_records[1], + test_records[len(test_records) // 2], + test_records[-2], + test_records[-1], + {"name": "Сергей", "phone": "89290504426"}, + ] + + for test in tests: + test_ll = copy.deepcopy(linked_list) + + result_delete = ll_delete(test_ll, test.get('name')) + + assert ll_find(result_delete, test.get('name')) is None \ No newline at end of file From 83651244fe5e87fb8e4b125170fa7bedcf755089 Mon Sep 17 00:00:00 2001 From: SerKin0 <71343548+SerKin0@users.noreply.github.com> Date: Wed, 18 Mar 2026 19:52:13 +0300 Subject: [PATCH 9/9] =?UTF-8?q?[1]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20docstring=20=D0=BA=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D1=8F=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skorohodovsa/task_1/linked_list.py | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/skorohodovsa/task_1/linked_list.py b/skorohodovsa/task_1/linked_list.py index 9248ec7..d9a6948 100644 --- a/skorohodovsa/task_1/linked_list.py +++ b/skorohodovsa/task_1/linked_list.py @@ -25,6 +25,21 @@ def create_linked_list(data: list[dict]) -> dict: def ll_insert(head: dict, name: str, phone: str) -> dict: + """Добавление нового или редактирование элемента в связном списке + + Если пользователь уже есть в списке, то обновятся его данные (номер телефона). В случае если + данных нет, то они добавляются в конец. + + :param head: Список словарей с параметрами: {'name': str, 'phone': str, next: dict | None} + :type head: dict + :param name: Имя пользователя (не должно повторятся с имеющимися) + :type name: str + :param phone: Номер телефона пользователя (не должно повторятся с имеющимися) + :type phone: str + :raises ValueError: Ошибка при подаче на вход пустого списка + :return: Возвращает связный список с обновленными данными + :rtype: dict + """ if head is None: raise ValueError("Словарь пустой!") @@ -42,6 +57,21 @@ def ll_insert(head: dict, name: str, phone: str) -> dict: def ll_find(head: dict, name: str) -> str | None: + """Поиск пользователя в связном списке + + Если функция найдёт пользователя по имени, то вернёт его номер телефона. + В противном случае будет возвращено значение None. + + В случае повторяющихся имен в списке, выведется выше стоящие + + :param head: Список словарей с параметрами: {'name': str, 'phone': str, next: dict | None} + :type head: dict + :param name: Имя пользователя + :type name: str + :raises ValueError: Ошибка при подаче на вход пустого списка + :return: Возвращает номер телефона найденного пользователя, иначе None + :rtype: str | None + """ if head is None: raise ValueError("Словарь пустой!") @@ -54,6 +84,16 @@ def ll_find(head: dict, name: str) -> str | None: def ll_delete(head: dict, name: str) -> dict: + """Удаление пользователя из связного списка + + :param head: Список словарей с параметрами: {'name': str, 'phone': str, next: dict | None} + :type head: dict + :param name: Имя пользователя + :type name: str + :raises ValueError: Ошибка при подаче на вход пустого списка + :return: Возвращает связный список с обновленными данными + :rtype: dict + """ if head is None: raise ValueError("Словарь пустой!")