Python Institute PCPP1 – Certified Professional in Python Programming 1 PCPP-32-101 Question # 7 Topic 1 Discussion
PCPP-32-101 Exam Topic 1 Question 7 Discussion:
Question #: 7
Topic #: 1
Look at the following examples of comments and docstrings in PythonSelect the ones that are useful and compliant with PEP 8 recommendations (Select the two best answers.)
According to PEP 8 recommendations, the two best options are Option B and Option D.
Option B follows PEP 8’s suggestion that all lines should be limited to 79 characters and for longer blocks of text like docstrings or comments, the length should be limited to 72 characters1. Option D follows PEP 8’s conventions for writing good documentation strings (a.k.a. “docstrings”) which are immortalized in PEP 257. It suggests writing docstrings for all public modules, functions, classes, and methods2.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit