nerdexam
Python_Institute

PCPP-32-101 · Question #16

Which of the following examples using line breaks and different indentation methods are compliant with PEP 8 recommendations? (Choose two.) A. B. C. D.

The correct answer is A. spam = my_function(arg_one, arg_two, arg_three, arg_four) C. my_list = [ 1, 2, 3, 4, 5, 6, ]. A: The first example in (https://peps.python.org/pep-0008/#indentation). Vertical alignment with the opening delimiter C: The closing braces/bracket/parenthesis on multiline constructs may either line up under the first non-whitepace character of the last line of the list or…

PEP and Best Practices

Question

Which of the following examples using line breaks and different indentation methods are compliant with PEP 8 recommendations? (Choose two.) A. B. C. D.

Exhibit

PCPP-32-101 question #16 exhibit

Options

  • Aspam = my_function(arg_one, arg_two, arg_three, arg_four)
  • Beggs = (1, 2, 3, 4, 5, 6)
  • Cmy_list = [ 1, 2, 3, 4, 5, 6, ]
  • Dfoo = my_function ( arg_one, arg_two, arg_three, arg_four )

How the community answered

(59 responses)
  • A
    92% (54)
  • B
    3% (2)
  • D
    5% (3)

Explanation

A: The first example in (https://peps.python.org/pep-0008/#indentation). Vertical alignment with the opening delimiter C: The closing braces/bracket/parenthesis on multiline constructs may either line up under the first non-whitepace character of the last line of the list or may be lined up under the first character of the line that starts the multiline construct.

Topics

#PEP 8#line breaks#indentation#code formatting

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice