18 lines
502 B
Python
18 lines
502 B
Python
class Phrase:
|
|
"""A class to represent phrases."""
|
|
|
|
def __init__(self, content):
|
|
self.content = content
|
|
|
|
def processed_content(self):
|
|
"""Process the content for palindrome testing."""
|
|
return self.content#.lower()
|
|
|
|
def ispalindrome(self):
|
|
"""Return True for a palindrome, False otherwise."""
|
|
return self.processed_content() == reverse(self.processed_content())
|
|
|
|
def reverse(string):
|
|
"""Reverse a string."""
|
|
return "".join(reversed(string))
|