nerdexam
Python_Institute

PCPP-32-101 · Question #77

Select the true statement about PEP 8 recommendations related to imports.

The correct answer is A. Imports should be put at the top of a file, after module comments and dosctrings. PEP 8 recommends placing imports at the top of the file, following any module-level comments

PEP and Best Practices

Question

Select the true statement about PEP 8 recommendations related to imports.

Options

  • AImports should be put at the top of a file, after module comments and dosctrings.
  • BImports should be put at the top of a file, before module comments and docstrings.
  • CWildcard imports, for example from modulename import *, are encouraged, because they
  • DImports should be put at the top of a file, after module globals and constants.

How the community answered

(38 responses)
  • A
    89% (34)
  • B
    3% (1)
  • C
    5% (2)
  • D
    3% (1)

Explanation

PEP 8 recommends placing imports at the top of the file, following any module-level comments

Topics

#PEP 8#imports#module structure#wildcard imports

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice