+ 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)))
4 Antworten
+ 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