Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 28, 2020 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/0fda438344ce453dda92c3bcd7bf08d9 to your computer and use it in GitHub Desktop.
Save codecademydev/0fda438344ce453dda92c3bcd7bf08d9 to your computer and use it in GitHub Desktop.
Codecademy export
# Write your sum_values function here:
def sum_values(my_dictionary):
sum = 0
for values in my_dictionary.values():
sum += values
return sum
# Uncomment these function calls to test your sum_values function:
print(sum_values({"milk":5, "eggs":2, "flour": 3, 'cat': 'animal'}))
# should print 10
print(sum_values({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