Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+3 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 (8 points)

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 (8 points)
+1

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

+1

how do i find the same largest count ?

+1
+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 (8 points)
+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 (8 points)
...