Junior — Senior
Sorting a list of words by their last character
livecode
Task condition
Rewrite the sort_words function so that it takes a list of strings words and returns a new list sorted by the last character of each word. Use the built-in sorted function and the key argument.
def sort_words(words: list[str]) -> list[str]:
return sorted(words, key=lambda w: w[-1])
raw_input = input().split(',')
print(sort_words(raw_input))