Question: (10 Pts) [Task-9] Define a function calledgetTopelementsthat takes a string as aninput and returns the m
-
Question: (10 Pts) [Task-9] Define a function calledgetTopelementsthat takes a string as aninput and returns the most common 3 letters in that string. If the characters havesame frequency, it should return in alfabetical order.Sample input/Output:—print(getTopelements(”programming”))Most common three letters are: m, a, g
(10 Pts) [Task-9] Define a function calledgetTopelementsthat takes a string as aninput and returns the most common 3 letters in that string. If the characters havesame frequency, it should return in alfabetical order.Sample input/Output:—print(getTopelements(”programming”))Most common three letters are: m, a, g -
Here’s the best way to solve it.Solution
The function `getTopelements` can be defined using…
OR