Let's say I have the following class:
class MyClass:
def __init__(self, text):
self.text = text
def strip(self):
strip_text = self.text.strip()
return strip_text
def reverse(self):
rev_text = self.text.strip()[::-1]
return rev_text
my_name = MyClass('todd ')
I want to able to to call the methods to this class like this:
my_name.strip().reverse()
However, when I do so, it throws an error. How do I go about chaining methods?