Created
August 9, 2016 22:42
-
-
Save Gwith/7373764d35b6a75f51ea30c8b2c3f6a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test1 = { 'cat' : 1, 'dog' : 1, 'bird' : 1} | |
| test2 = { 'cat' : 3, 'dog' : 2, 'cow' : 2 } | |
| for key, value in test2.items(): | |
| test1[key] = test2.get(key, 0) + 1 | |
| print(test1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment