Text analysis doubt | Sololearn: Learn to code for FREE!

+1

Text analysis doubt

The code given below is to find percentage oof characters that each character occupies in a text file. Please explain me last print statement for char in "abcdefghijklmnopqrstuvwxyz": perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2)))

12/17/2020 12:58:13 PM

Harshita Sharma

4 Answers

New Answer

+1

f string and format string. Check at python course

+1

copy paste below code and see. Hope you will understand: a = "Aman" b = "Bayram" print(f'{a} and {b} are friends') print("{0} and {1} are friends".format(a,b))

0

What is this ({0}-{1}%) for?

0

Ohk..i got it. Thanks