Question: Problem 5 : Same Backwards as Forwards A palindrome is a word or phrase that reads the same both forwards and backwards. racecar is a
Problem : Same Backwards as Forwards A palindrome is a word or phrase that reads the same both forwards and backwards. "racecar" is a palindrome. So is "a man a plan a canal, panama" if you ignore the spacing and the comma. Discovering how to automate the detection of palindromes is a good way to test your understanding of loops and strings. problempy contains a function called is palindrome which has a single string parameter, s Ifs is a palindrome, then is palindrome returns the value True. If s is not a palindrome, then the function is palindrome returns the value False. Complete the body of the function by adding statements that will determine whether the input string s is a palindrome or not. Use a loop to perform this test. Return True if it is Return False if it is not. BE CAREFUL: The input string, s can be a word or a phrase. If it is a phrase, like the example above, then you must ignore the spacing when testing whether it is a palindrome: only the letters and numbers matter. You can assume that none of the input strings will contain any punctuation. You can also assume that all the characters in the input string will be lowercase. Examples: Function Call is palindromeracecar is palindromeraceboat ispalindromea man a plan a canal panama is palandromea place to call up is palindromedeified Return Value True False True False True
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
