python_math_stat/practica/stepik/stepik_tasks/update_dictionary.py
2023-11-22 23:56:55 +03:00

12 lines
270 B
Python

# function of update dict d
d = {}
def update_dictionary(d,key,value):
if key not in d:
new_key = int(key) *2
if new_key not in d:
d[new_key] = [value]
else:
d[new_key] += [value]
else:
d[key] += [value]