Python

Palindrome Verify

Check if user input is a palindrome

This program shows an example of using a try except statement.

The program asks the user for a input and exits if interrupted. If not the input is checked against its opposite using slicing and returns the result.

Example:

> python palindrome.py

> This program determines if a phrase is a palindrome.

> Type ^c to exit.

> Please enter a phrase: applert

> No!, "applert" is not a palindrome.

> Please enter a phrase: sapas

> Yes!, "sapas" is a palindrome.

> Please enter a phrase:

> Closing the application.