Question: A start up program is provided, which has a MyString class. This class has one data attribute __myString, and two methods. countWord method calculates how
A start up program is provided, which has a MyString class. This class has one data attribute __myString, and two methods.
countWord method calculates how many words in __myString
findMostFrequentChar method finds the most frequent alphabetic character in __myString (case insensitive)
Main method is already provided. You need to implement countWord method and findMostFrequentChar method in MyString class.
For Reference:
class MyString:
def __init__(self, myString): self.__myString = myString
def countWord(self): #needs implementation
def findMostFrequentChar(self): #needs implementation (case insensitive)
def main(): aString = MyString("This is a super long long long string. Please help count me") print("There are", aString.countWord(), "words in the string.") count, letter = aString.findMostFrequentChar() print("The most frequent character is", letter, "which appeared", count, "times")
main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
