diff --git a/BudakovIS/docs/LinkedListPhoneBook.py b/BudakovIS/docs/LinkedListPhoneBook.py index 4e1507d..d7529fc 100644 --- a/BudakovIS/docs/LinkedListPhoneBook.py +++ b/BudakovIS/docs/LinkedListPhoneBook.py @@ -49,6 +49,11 @@ print(head) head = ll_insert(head, 'Boris', '111-222') print(head) + +head = ll_insert(head, 'Methody', '221-112') + +head = ll_insert(head, 'Kiril', '112-221') + print(f"======= END TEST =======\n\n\n") @@ -88,4 +93,27 @@ def ll_delete(head, name): curent = curent['next'] return head + +print("====== TEST ll_delete FUNC ======") + print("Del of Dima:", ll_delete(head, 'Dima')) + +print("====== END TEST ======") + + +def ll_list_all(head): + records = [] + curent = head + while curent is not None: + records.append((curent['name'],curent['phone'])) + curent = curent['next'] + records.sort(key=lambda pair: pair[0]) + return records + +print(f"\n\n\n\n") + +print("====== TESTING ll_list_all FUNC ======") + +print(ll_list_all(head)) + +print("====== END ======")