+ 1

Can anyone please explain below line for me print("{0}-{1}%".format(char, round(perc,2))).??

14th Mar 2016, 2:38 PM
pruthvirajkankipati
2 Answers
+ 2
print("{0} - {1}%".format(char, round(perc, 2))) This line formats a string to contain the processed character (char) at the first index '{0}' and the percentual occurrence of that character (perc) - rounded by 2 decimals - at the second index '{1}'. It then prints the whole string. So, the first iteration of the loop - counting the occurrence of the letter 'a' - returns 'a - 4.68%.'
25th Feb 2016, 12:55 AM
Lars
Lars - avatar
+ 1
i can't understand.... can you please explin more....pls?
29th May 2020, 4:32 AM
SAI PAVAN TM
SAI PAVAN TM - avatar