Question
Hi, I would be grateful for some help with the following Python question in relation to string manipulation. Thanks This question tests your ability to
Hi, I would be grateful for some help with the following Python question in relation to string manipulation. Thanks
This question tests your ability to manipulate strings. A palindromic word is one that reads the same backwards as forwards. Hence the words hello and peel are not palindromes, but the words peep, deed and dad are palindromes. (a) Create a class called Palindrome.
(b) In your Palindrome class, create a method called reverse() which takes a string argument. Your method should return the reverse of the argument as a string. For example, if the argument is Foobar then your method should return rabooF.
(c) Create a second method in Palindrome called isPalindrome() which takes a string argument. This method should return True if the argument is a palindrome and False otherwise.
(d) Write some code to test your new Palindrome class and print out results of your testing to the user. Give some consideration to what sort of strings you might want to use for your testing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started