Question: ( h ) ( 1 0 Pts ) [ Task - 8 ] Define a function called hist _ B which takes the Output dictionary

(h)(10 Pts)[Task-8] Define a function called hist_B which takes the Output dictionary (given by hist_A [Task-7]) as an input. And create a new dictionary which maps from frequencies to letters.
Sample input/Output:
res = hist_A("kara murat kim"))- print(hist_B(res))['u','t','i'],2: [','r','k','m'],3: ['a']}
(i)(10 Pts)[Task-9] Define a function called getTopelements that takes a string as an input and returns the most common 3 letters in that string. If the characters have same frequency, it should return in alfabetical order.
Sample input/Output:
print(getTopelements("programming"))
Most common three letters are: m,a,g
(j)(10 Pts)[Task-10] Define a function called compress_dict, it compresses the strings that have long sequences of equal characters. The program will accept one string as an argument, and return compressed form of the string.
Sample input/Output:
print(compress_dict("aaaabbaaabbbbbbcccd"))
4a2b3a5b3c1d
 (h)(10 Pts)[Task-8] Define a function called hist_B which takes the Output

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 Programming Questions!