It reads the same forwards and backwards.

A palindrome is a word, number or phrase that reads the same backwards as forwards, such the words madam or racecar.

Palindrome

⭐⭐⭐

Make

Write a program that allows the user to enter a word or sentence. The program outputs whether the input is a palindrome or not.

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called palindrome that:

  1. Takes a string parameter phrase to be processed.
  2. Returns True if phrase is a palindrome.
  3. Returns False if phrase is not a palindrome.

Note the algorithm will need to ignore case, whitespace and punctuation.

Complete the main program so that:

  1. The user can input a word, phrase or sequence of digits.
  2. The program outputs whether the phrase is a palindrome or not.

Typical inputs and outputs from the program would be:

Enter a phrase: ABBA
ABBA is a palindrome.

Enter a phrase: 02/02/2020
02/02/2020 is a palindrome.

Enter a phrase: A man, a plan, a canal – Panama
A man, a plan, a canal – Panama is a palindrome.

Enter a phrase: Hello World
Hello World is not a palindrome.