12 lines
270 B
Python
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]
|