0

How can I make the letters measured in the percentage of this code be those of the user input and not those of the function?

https://code.sololearn.com/ckpSM1Co7Ia0/?ref=app

29th Apr 2020, 7:25 PM
Sentimiento Perico
Sentimiento Perico - avatar
2 Answers
+ 4
Just do like this text = input() def count_char(text, char): count = 0 for c in text: if c == char: count += 1 return count for char in text: perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2)))
29th Apr 2020, 7:42 PM
A͢J
A͢J - avatar
0
Thanks, I'll try it 😉
29th Apr 2020, 7:46 PM
Sentimiento Perico
Sentimiento Perico - avatar