diff --git a/VolkovVA/cod.py b/VolkovVA/cod.py index e69de29..7495326 100644 --- a/VolkovVA/cod.py +++ b/VolkovVA/cod.py @@ -0,0 +1,20 @@ +import random as rnd + +def ll_insert(head, name, phone): + new_node = {'name': name, 'phone': phone, 'next': None} + + if head is None: + return new_node + + + current = head + while current is not None: + if current['name'] == name: + current['phone'] = phone + return head + current = current['next'] + + + new_node['next'] = head + return new_node +