recursion.py
.
In that file, implement and test the following two functions:palindrome(a_string)
Is an extension of the book’s
palindrome function. It should take a string and return True
or False
, depending on whether or not the string is a
palindrome. However, it should ignore capitalization, spaces,
punctuation, and any characters that are not letters. You may NOT use
any built-in string methods for this problem. You may, of course, use
string indexing using square brackets.For example:
assert palindrome("Was it a car or a cat I saw?")
assert palindrome("Rise to vote, sir!")
assert palindrome("A man, a plan, a canal -- Panama!")
assert palindrome("Doc, note: I dissent. A fast never prevents a fatness. I diet on cod.")
licensePlates(length, letters, numbers)
is specified
in exercise 10.2.12 in our textbook.Hungry for more? For extra credit implement one of the additional fractals described in the section 10.1 exercises. Or try exercise 2 or 10 from this online textbook.
Submit recursion.py
using the online turnin form.
palindrome
- 3 ptslicensePlates
- 4 ptsGood luck, and have fun!
Created November 18, 2016
Thanks to Andy Exley for the draft writeup. Thanks to Wikipedia for examples of palindromes.
Last revised November 18, 2016, 08:23:17 AM PST
This work is licensed under a Creative
Commons Attribution-Noncommercial-Share Alike 3.0 United States License.