Advertisement
Guest User

script

a guest
Aug 27th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #/usr/bin/env pyhton3
  2.  
  3. import string
  4.  
  5. numberbet = {}
  6. count = 1
  7. for letter in string.ascii_lowercase:
  8. numberbet[letter] = count
  9. count += 1
  10.  
  11. def count_word(word):
  12. count = 0
  13. for letter in word.lower():
  14. count += numberbet[letter]
  15. return count
  16.  
  17.  
  18. with open('/usr/share/dict/words', 'r') as f:
  19. for line in f:
  20. line = line.strip()
  21. if line.isalpha():
  22. if count_word(line) == 100:
  23. print(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement