def is_candidate(wordlist, word):
    """True if word is a candidate for the homophone problem, in that
    it's five letters long, and removing either of the first two
    letters also results in a word.
    wordlist: dictionary of words
    word: string
    """
    word1 = word[1:]
    word2 = word[0]+word[2:]
    # Python evaluates and clauses left to right, so `p and q and r` is like
    # saying if p, then if q, then if r, return true. Otherwise return false.
    return len(word)==5 and word1 != word2 and word[1:] in wordlist and \
        word[0]+word[2:] in wordlist