PROGRAMMING EXERCISE

Palindromes

 

Write a program that determines whether or not a word or phrase input by the user is a palindrome (a word that is spelled the same way both forwards and backwards).  For example, the program should be able to tell that words like "RADAR" and "DEED" are palindromes. Furthermore, the program should be able to detect that a phrase such as "Madam, I'm Adam" is a palindrome. This involves "weeding out" the punctuation and spaces in the phrase and converting the phrase to either all upper- or all lower- case before beginning the test.

 

Here are some other fun phrases to use when testing this program:

"Dennis and Edna sinned."

"Naomi, did I moan?"

 

Sample tests are shown below:

 

 

 

 

Download the solution for this project here.