How I can output the letter frequency | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How I can output the letter frequency

You are making a program to analyze text. Take the text as the first input and a letter as the second input, and output the frequency of that letter in the text as a whole percentage. Sample Input: hello l Sample Output: 40

9th Mar 2021, 2:55 PM
Qusi AL-Hejazi
Qusi AL-Hejazi - avatar
2 Answers
+ 1
tekst = 'aman' lett = 'n' print((tekst.count(lett)*100)/len(tekst))
9th Mar 2021, 3:11 PM
Shadoff
Shadoff - avatar
+ 1
Thanks
9th Mar 2021, 4:25 PM
Qusi AL-Hejazi
Qusi AL-Hejazi - avatar