0

explain this line plz.......! print("{0} - {1}%".format(char, round(perc, 2)))

The part of the program finds what percentage of the text each character of the alphabet occupies. for char in "abcdefghijklmnopqrstuvwxyz": perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2)))

3rd Jul 2017, 12:27 AM
Edu Rut
Edu Rut  - avatar
1 Respuesta
+ 1
The variable char is is put into the placeholder position {0} and the result of the method round(perc, 2) is put into the placeholder {1} position from the format() method.
3rd Jul 2017, 12:35 AM
ChaoticDawg
ChaoticDawg - avatar