Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def exame1516_4():
- x1 = {3:5, 6:2, 'len':7}
- x2 = {1:2,3:4,5:3,'len':7}
- x3 = {}
- for c,v in x1.items():
- if c in x2.keys() and c is not 'len':
- value = x1.get(c) + x2.get(c)
- if c not in x3:
- x3[c] = value
- else:
- x3[c] = x1[c]
- for c,v in x2.items():
- if c in x1.keys() and c is not 'len':
- value = x1.get(c) + x2.get(c)
- if c not in x3:
- x3[c] = value
- else:
- x3[c] = x2.get(c)
- for i in range(x1.get('len')):
- if i not in x3.keys():
- x3[i] = 0
- print(x3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement