Question: Python Problem Extend the str class with your own class called ReverseStr # -- change the functionality of upper() and lower() so that they do
Python Problem Extend the str class with your own class called ReverseStr # -- change the functionality of upper() and lower() so that they do the opposite (lower makes/returns an upper-case, upper() makes/return an upper-case string) # -- adds a reverse() method that inverts the string (last character first) # -- when you do a int() conversion it should return the length # -- when you do a bool() type conversion it should check the string contains characters in order (i.e. text[0] < text[1] < text[2] < ... example: ACE and 17Wa hold true (look up ASCII table to know ordering, strings are comparable...i.e. you can use < on characters) def test(): rev = ReverseStr("Hello") print(rev.upper()) # prints "hello" print(rev.lower()) # prints "HELLO" print(int(rev)) # prints 5 print(bool(rev)) # prints False rev2 = ReverseStr("123ABCabc") print(bool(rev2)) # prints True print(rev) # prints "Hello" print(rev2) # prints "123ABCabc" 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
