17 Answers
New AnswerGuys please can you help me on the first project of python data structures im stuck please thank you on the letter frequency
2/24/2021 11:20:54 AM
Mochizuki Hinata17 Answers
New AnswerHope you're asking about this one :) stri=input() L= input() print(int(stri.count(L)/len(stri)*100))
Please share your attempt for your project as well as add description details to your question.
LETTER FREQUENCY word=input() letter=input() n=len(word) per=((word.count(letter)/n)*100) print(int(per))
txt = input() lter = input() co = 0 for i in txt: if i == lter: co +=1 print(int(co/len(txt)*100))
letter frequency: text = input() letter = input() counter = text.count(letter) frequency = int ((counter/len(text)) * 100) print(frequency)
text = input() letter = input() x = text.count(letter) y = len(text) percentage = (x*100)/y print(int(percentage))
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))
first = input() second = input() suum = first.count(second) div = len(first) total = (suum / div) * 100 print(int(total))
dat = input() x = input() vs = dat.count(x) res =int((vs/len(dat))*100) print(res)
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.
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!
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..
Just got it correct but I am not sure if I will not be penalised for sharing the solution.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message