Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 25, 2019 21:07
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/3a26efe9d5162100f83173a8e326fc67 to your computer and use it in GitHub Desktop.
Save codecademydev/3a26efe9d5162100f83173a8e326fc67 to your computer and use it in GitHub Desktop.
Codecademy export
def frequency_dictionary(words):
dictionary = {}
for word in words:
dictionary[word] = 0
for word in words:
dictionary[word] += 1
return dictionary
print(frequency_dictionary(["apple", "apple", "cat", 1]))
print(frequency_dictionary([0,0,0,0,0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment