[3] adding ll_list_all

This commit is contained in:
IvanBud123 2026-02-28 05:02:47 +03:00
parent 8a5904376c
commit 668c233d2c

View File

@ -49,6 +49,11 @@ print(head)
head = ll_insert(head, 'Boris', '111-222') head = ll_insert(head, 'Boris', '111-222')
print(head) print(head)
head = ll_insert(head, 'Methody', '221-112')
head = ll_insert(head, 'Kiril', '112-221')
print(f"======= END TEST =======\n\n\n") print(f"======= END TEST =======\n\n\n")
@ -88,4 +93,27 @@ def ll_delete(head, name):
curent = curent['next'] curent = curent['next']
return head return head
print("====== TEST ll_delete FUNC ======")
print("Del of Dima:", ll_delete(head, 'Dima')) 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 ======")