'''
Created on Nov 1, 2017

@author: Susan Rodger
'''

# Given a phrase, and a letter, return the 
#  longest word that has that letter in it.

def findWords(phrase, letter): 
    return [phrase.split()[i] for i in range(len(phrase.split()))
             if letter in phrase.split()[i] ]
    


def findWords2(phrase, letter): 
    wordlist = phrase.split()
    answer = []
    for i in range(len(wordlist)):
        if letter in wordlist[i]:
            answer.append(wordlist[i])
    return answer

if __name__ == '__main__':    
    print findWords("the circus is coming to town with elephants and clowns", "o")

    print findWords("the circus is coming to town with elephants and clowns", "n")    
    
    print findWords2("the circus is coming to town with elephants and clowns", "o")

    print findWords2("the circus is coming to town with elephants and clowns", "n")