 letter frequency on python data structures | Sololearn: Learn to code for FREE!

+2

# letter frequency on python data structures

Guys please can you help me on the first project of python data structures im stuck please thank you on the letter frequency

+14

+6

+6

LETTER FREQUENCY word=input() letter=input() n=len(word) per=((word.count(letter)/n)*100) print(int(per))

+4

txt = input() lter = input() co = 0 for i in txt: if i == lter: co +=1 print(int(co/len(txt)*100))

+3

Thank you very much, My last line was wrong

+3

letter frequency: text = input() letter = input() counter = text.count(letter) frequency = int ((counter/len(text)) * 100) print(frequency)

+2

¿¿¿¿Just give a hint or something????

+2

text = input() letter = input() x = text.count(letter) y = len(text) percentage = (x*100)/y print(int(percentage))

+2

Here is my solution (hope it helps) text=input() letter=input() count=0 frequency=0 for c in text: if c==letter: count+=1 n=len(text) frequency=(count/n)*100 print(int(frequency))

+1

first = input() second = input() suum = first.count(second) div = len(first) total = (suum / div) * 100 print(int(total))

+1

dat = input() x = input() vs = dat.count(x) res =int((vs/len(dat))*100) print(res)

0

can you put the coding for this question 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 The letter l appears 2 times in the text hello, which has 5 letters. So, the frequency would be (2/5)*100 = 40.

0

x=input() y=input() print(int(x.count(y)/len(x)*100))

0

Prakhar, damn, mate, seeing the simple int function at the end of your option I feel so dumb after solving this with the math.trunc method 😅 Well done!

0

text = input() letter = input() analyzed = letter in text letter_count = text.count(letter) text_len = len(text) if analyzed: print(int((letter_count / text_len) * 100)) # my take..

-6

Just got it correct but I am not sure if I will not be penalised for sharing the solution.