Skip to content

Instantly share code, notes, and snippets.

@sullyj3
Created February 6, 2014 06:31
Show Gist options
  • Save sullyj3/8839268 to your computer and use it in GitHub Desktop.
Save sullyj3/8839268 to your computer and use it in GitHub Desktop.
def checkio(text):
nopunc=""
alph="abcdefghijklmnopqrstuvwxyz"
for char in text:
if char.lower() in alph:
nopunc+=char.lower()
maxcount=1
mostfreq=""
for letter in nopunc:
if nopunc.count(letter)>maxcount:
maxcount=nopunc.count(letter)
mostfreq=letter
elif nopunc.count(letter)==maxcount:
if alph.find(letter)<alph.find(mostfreq):
mostfreq=letter
elif mostfreq="":
mostfreq=letter
return mostfreq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment