head = None #node1 = {'name' : 'Ivan', 'phone' : '123-456', 'next' : None} #head = node1 #node2 = {'name' : 'Dima', 'phone' : '789-123', 'next' : None} #node1['next'] = node2 def ll_insert(head, name, phone): curent = head while curent is not None: if curent['name'] == name: curent['phone'] = phone return head curent = curent['next'] n_node = {'name' : name, 'phone' : phone, 'next' : None} if head is None: return n_node curent = head while curent['next'] is not None: curent = curent['next'] curent['next'] = n_node return head ptiny("====== TESTING ll_insert FUNC ========") head = ll_insert(head,'Ivan','123-456') print(head) head = ll_insert(head, 'Boris', '123-456') print(head) head = ll_insert(head, 'Ivan', '321-654') print(head) head = ll_insert(head, 'Dima', '345-678') print(head) head = ll_insert(head, 'Boris', '111-222') print(head) print("======= END TEST =======")