Wrong explanation of the "f" inside "autopct" argument
In this lecture, the explanation of formatting percentage for each slice in the pie chart with
autopct = '%.2f%%'
argument mentions that the
".2" part is for 2 decimal places after the dot and
"f%" for the percent symbol. I'm afraid that's not right. This instead has to do with Python's format string which defines the
"f" to be a float descriptor for a number and the preceding
".2" defines the constraint on that number, that is, the part
".2f" represents that the number in this place will have 2 digits after the decimal symbol and the
"%" will be printed like any other printable character in Python. Then the first and the last
"%" symbol indicates the text given in
autopct argument as a value should be considered as the active math-text format and follow the rules for that math-text formatting system.
Hi Md Abdur,
thanks for reaching out! We'll implement your feedback and revise the course materials as soon as possible.