Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Last answered:

13 Dec 2022

Posted on:

12 Dec 2022


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.

1 answers ( 0 marked as helpful)
Posted on:

13 Dec 2022


Hi Md Abdur,
thanks for reaching out! We'll implement your feedback and revise the course materials as soon as possible.

365 Eli

Submit an answer