#---------------------------------------------------------------------- def sort_by_length(word_list): """Sort the words in word_list in order of increasing length This is a slight modification of a function in Section 12.7 of Allen Downey, Python for Software Design""" t_list = [] for word in word_list: t_list.append((len(word), word)) t_list.sort() new_list = [] for length, word in t_list: new_list.append(word) return new_list