Write a program that imports a file containing Unix commands and prints the last letter of each line.
Represent the file as a list of strings, where each string is one input line and may include a trailing or \r . Return a list containing the final character of each line after removing only its line terminator. For an empty line, return an empty string. The caller can print one returned value per line.
Function signature: def last_characters(lines):
The input contains at most 1,000 lines. Preserve all characters other than line terminators.
def last_characters(lines):