Problem 1, isSquareFree def isSquareFree(num): for div in range(2,num): sq = div*div if num % sq == 0: return False return True Problem 1, isPerfect def isPerfect(num): sum = 0 for div in range(1,num): if num % div == 0: sum += div return sum == num alternatively, replace the last line/return statement with if sum == num: return True return False ---- We hadn't really covered list comprehensions at the time of the redux/booster question. If we had this would work def isPerfect(num): return sum([div for div in range(1,num) if num % div == 0]) == num --- Problem 1B def wordCount(words,sub): s = 0 for w in words: if sub in words: s += 1 return s def wordCount(words,sub): return len([w for w in words if w.find(sub) > -1]) ---- Problem 2 def getAgeList(filename, low, high): file = open(filename) # The call to strip() on the next line removes the newline character at the # end of each line of the file. contents = [line.strip().split(",") for line in file] # At this point, contents is a list of lists of strings: each element # corresponds to an animal, and it contains a list of [name, gestation, # life], all of which are strings. # Remember to close your files when you're done reading from them! file.close() # Remember to convert the life expectancy from a string to an int! animals = [entry[0] for entry in contents if (low <= int(entry[2])) and (int(entry[2]) <= high)] return animals