Question: In Python I need to write a program that displays the most frequent character, I am not sure what to put where I have questions

In Python I need to write a program that displays the most frequent character, I am not sure what to put where I have questions marks. Here is what I have so far:

#Function displays the character that appears most frequently #in the string. if several characters have the same freqency # the this displays the first character with that frequency

def main(): #Set up local variables count = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' index = 0 frequent = 0 # Recenuve user input user_string = input('Enter your text:') for ch in user_string: ?? = ??.upper() #Determine which letter this character is index = letters.find(ch) if index>=0: #Increase counting array for this letter count[index] = count[index]+1 for i in range(len(count)): if count[i] > count[frequrnt]: frequent = i print('Your most frequent character is:', letters[frequent], '.',sep='') #Call the main function 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!