Question: Write a program in python that takes a word from input, determines if it is a palindrome, and displays the result. A palindrome is a
Write a program in python that takes a word from input, determines if it is a palindrome, and displays the result.
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as madam or racecar.
This problem can be easily solved by using a stack and a queue. Here is some code that will allow you to access characters individually in a word:
for letter in word:
Design a function called isPalindrome() which takes the word entered as an input parameter and returns True if the word is a palindrome or False if the word is not a palindrome. Write a main function which loops to read in words until the user enters a sentinel word (you decide the sentinel value). The main function will print a message: "The word is a palindrome!" if the isPalindrome function returns True, otherwise, the main function will print a message: "The word is NOT a palindrome".
Please include Source code with IPO comments and screen shot of testing. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
