Would you describe this 3 line of code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Would you describe this 3 line of code ?

I know the goal of this code but don't know its logic and how it can be reach to the expected output: https://code.sololearn.com/c65s3FG7F4I3/?ref=app

3rd Feb 2018, 6:39 PM
NIMA
NIMA - avatar
1 Answer
+ 2
The for loop takes one alphabet at a time and calculate the frequency of it in the given text. if you divide it by the length of the given text, it gives the percentage of appearance. The print just prints this in a decimal format with two decimals after the dot.
3rd Feb 2018, 7:28 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar