PCPP-32-101 · Question #22
Look at the following code snippets and decide which ones follow PEP 8 recommendations for whitespaces in expressions and statements. (Choose two.)
The correct answer is A. No whitespace immediately before the opening parenthesis that starts the list of arguments of a C. No whitespace between a trailing comma and a following closing parenthesis. PEP 8 recommends avoiding extraneous whitespace immediately inside parentheses, brackets or PEP 8 recommends avoiding extraneous whitespace between a trailing comma and a following close parenthesis 1.
Question
Look at the following code snippets and decide which ones follow PEP 8 recommendations for whitespaces in expressions and statements. (Choose two.)
Exhibits
Options
- ANo whitespace immediately before the opening parenthesis that starts the list of arguments of a
- BA whitespace immediately before a comma, semicolon, and colon
- CNo whitespace between a trailing comma and a following closing parenthesis
- DA whitespace immediately after the opening parenthesis that starts indexing or slicing
How the community answered
(55 responses)- A95% (52)
- B4% (2)
- D2% (1)
Explanation
PEP 8 recommends avoiding extraneous whitespace immediately inside parentheses, brackets or PEP 8 recommends avoiding extraneous whitespace between a trailing comma and a following close parenthesis 1.
Topics
Community Discussion
No community discussion yet for this question.

