0
what is the meaning of code
print("{0} - {1}%".format(char, round(perc, 2))) in this line i donot understand what is work and meaning of {0}-{1}% can u just clarify me detail about it
1 ответ
+ 6
It's a special designation of string formatting. The numbers represent the positions of argument of the format method that follows in the expression. So, bearing in mind that Python starts counting from zero, {0} represents the first argument - char and {1} represents the second argument - round(perc, 2)
You can read more on string formatting possibilities here:
https://docs.python.org/3/library/string.html#string-formatting