Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # b_inv.py
- inv = {
- "Gold": 200,
- "Silver": 1500,
- "Ruby": 3,
- "Diamond": 16,
- }
- loot = {
- "Gold": 10,
- "Silver": 80,
- "Diamond": 2,
- "Emerald": 4,
- "Sapphire": 2,
- "Topaz": 1
- }
- new_inv = {k: inv.get(k, 0) + loot.get(k, 0) for k in set(inv) | set(loot)}
- print(new_inv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement