Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+4 votes

Hi for question 1, i am currently looping through the values to find the max value, and returning it. But how do i get the proper key to print?

How do you tell thonny which lettter comes first in the alphabet ?

asked in CSC201 Spring 2021 by (1 point)

3 Answers

+3 votes

You could create an empty list. Then, go through each item in the dictionary, append all the letters which have the same largest count. Then, use the sort method to make an alphabetized list of the letters and return the first element of the list.

answered by (1 point)

I was stuck on this problem and this advice was very helpful! Thank you!!


how do i find the same largest count ?

+2 votes

Actually a better way to do this is by going through each item in the dictionary by using .items() and finding the max value.

answered by (1 point)
+1 vote

I think that you could access the dictionary and create a list with each letter in the dictionary and sort the list and then print the first letter in the list. I am not sure if that is the right way but it might be worth a shot????

answered by (1 point)