+ 3

Can someone help me out... I don't know how to solve this problem. Please.

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 (Python).

23rd Feb 2021, 4:37 PM
Niviedha shekor
Niviedha shekor - avatar
3 Respuestas
+ 1
Um, pseudo code should look something like this def freq(text, char): counter 0 #start iter iterate through text per character if text[i] == char then counter+= 1 #end iter p = counter/text.length return (p*100)
23rd Feb 2021, 4:45 PM
Akib
Akib - avatar
+ 1
loop over the text , compare each character in text to the letter and increment a variable by 1 . now print the percentage as variable/len(text) *100. Show your attempt for further help .
23rd Feb 2021, 4:46 PM
Abhay
Abhay - avatar
0
text = input() letter = input() s = text.count(letter) n= len(text) freq = (s/n*100) print(int(freq))
8th Jul 2022, 12:29 PM
PAULINE ONYEUKWU