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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!