-
-
Save codecademydev/987ff0029304953d6d7e24e9f7513d01 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains 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
# Write your sum_even_keys function here: | |
def sum_even_keys(my_dictionary): | |
count = 0 | |
for key in my_dictionary.keys(): | |
if key%2 == 0: | |
count += my_dictionary[key] | |
return count | |
# Uncomment these function calls to test your function: | |
#print(sum_even_keys({1:5, 2:2, 3:3})) | |
# should print 2 | |
#print(sum_even_keys({10:1, 100:2, 1000:3})) | |
# should print 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment