class Solution:
def add1(self, dic1,dic2):
for key in dic1.keys():
if key in dic2.keys():
dic1[key]=dic1[key]+dic2[key]
for key in dic2.keys():
if key not in dic1.keys():
dic1[key]=dic2[key]
return(dic1)
kk=Solution()
if __name__=="__main__":
print(kk.add1({"a":1,"k":3,"u":9},{"a":100,"u":5,"r":100}))
No comments:
Post a Comment