Hi all its me needing help again :P
My exercise says: Write a function wordPop that accepts a text and a length N and returns the list of all the words that are N letters long, sorted by their length.
okay so what I have is 2 fuctions first:
def length_compare(x, y): return len(x) - len(y)
def wordPop(text, n): nwords =  words = text.split() for word in words: if (len(word) <= n): nwords.append(word) nwords = sorted(nwords,cmp=length_compare) return nwords
Here is where i run into the problem i type in
nwords = wordPop("the cat ate the rat in the hat",3)
which gives me an error.. :( please help