Skip to content

Instantly share code, notes, and snippets.

@chriszf
Created October 9, 2012 18:37
Show Gist options
  • Save chriszf/3860594 to your computer and use it in GitHub Desktop.
Save chriszf/3860594 to your computer and use it in GitHub Desktop.
Exercise 09 Solution
def main():
f = open("twain.txt")
text = f.read()
f.close()
text = text.lower()
num_letters = [0] * 26
for letter in text:
ascii_code = ord(letter) - 97
if 0 <= ascii_code < 26:
num_letters[ascii_code] += 1
for count in num_letters:
print count
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment