This week's puzzle was great for programming!

Take the word EASY: Its first three letters — E, A and S — are the 5th, 1st, and 19th letters, respectively, in the alphabet. If you add 5 + 1 + 19, you get 25, which is the value of the alphabetical position of Y, the last letter of EASY. Can you think of a common five-letter word that works in the opposite way — in which the value of the alphabetical positions of its last four letters add up to the value of the alphabetical position of its first letter?

Here's the code implementing it:

from __future__ import print_function

import string

    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen

LETTERS = string.ascii_lowercase
SCORES = {each: i+1 for i, each in enumerate(LETTERS)}

def check_word(word):
    if all(char in LETTERS for char in word):
        score1 = SCORES[word[:1]]
        score2 = sum([SCORES[x] for x in word[1:]])
        if score2 == score1:
            return True

def main():
    words = urlopen(DICTIONARY_URL).read().decode('utf-8').splitlines()
    potentials = [x.lower() for x in words if len(x) == 5]
    for word in potentials:
        if check_word(word):

if __name__ == '__main__':

This runs in under a second, including the HTTP request to get an English dictionary. You can optimize it a bit more by filtering more, but that's up to you if you want to.