Sue Evans
What does strings.dat look like?
palindromes String manipulation and recursion Otto Command-line arguments Anna file handling Able was I ere I saw Elba import sys Madam, I'm Adam. Is this a letter? List of strings? Was it a cat I saw? A man, a plan, a cat, a canal: Panama?
import sys and string Make sure correct number of command-line args were entered, exiting if not Open the file for reading Read the lines in the file into a list of strings (don't forget to strip the trailing whitespace) Close the file For each of the strings in the list of strings Make a temporary string that holds only the letters of the string all in upper case Determine if the temporary string is a palindrome. If it is, print its original string
lab12.py contains some functions that have been written for you, and a commented main() with no code.
You will have to write main() and the function isPalindrome(), which must be a recursive function.
linuxserver1.cs.umbc.edu[138] python lab12.py strings.dat The palindromes in the file are: Otto Anna Able was I ere I saw Elba Madam, I'm Adam. Was it a cat I saw? A man, a plan, a cat, a canal: Panama? linuxserver1.cs.umbc.edu[139]