Skip to content

Instantly share code, notes, and snippets.

@timtan
Created March 26, 2013 12:24
Show Gist options
  • Save timtan/5244993 to your computer and use it in GitHub Desktop.
Save timtan/5244993 to your computer and use it in GitHub Desktop.
normal
__author__ = 'tim'
fruits = [
'apple', 'pineapple',
'apple', 'pineapple',
'apple', 'pineapple',
]
counter = {}
for fruit in fruits:
if fruit in counter:
counter[fruit] +=1
else:
counter = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment