Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. with open('wordlist.txt') as wordList: #open wordlist file
  2.   for word in wordList: #iterate through words in list
  3.     wordTotal = 0
  4.     for c in word.upper(): #iterate through letters in word
  5.       charNum = ord(c)-64 #convert a-z to 1-26
  6.       if charNum >= 1 and charNum <= 26: #ignore non-letters
  7.         wordTotal += charNum #add letter to word total
  8.     if wordTotal == 100:
  9.       print (word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement