• 8 hours
  • Easy

Free online content available in this course.



Got it!

Last updated on 3/28/24

Apply the PEP 8 Style Guide to Python Code

Evaluated skills

  • Apply the PEP 8 style guide to Python code
  • Question 1

    Which of these is NOT a valid reason to ensure your code conforms to the PEP 8 guidelines?

    • Other developers will be able to understand your code faster.

    • You can guarantee to other developers that your code is free of bugs.

    • If you modify your code later, you are less likely to introduce new bugs.

    • Your code will be easy to read even when displayed in a narrow window. 

  • Question 2

    Which of the following is a valid docstring?

    • def foo():
          # Calculates the meaning of life.
          return 42
    • def foo():
      # Calculates the meaning of life.
          return 42
    • def foo():
          """Calculates the meaning of life."""
          return 42
    • """Calculates the meaning of life."""
      def foo():
          return 42
  • Question 3

    If you find something called FooBar in some Python code that conforms to PEP 8, what must it be?

    • A variable

    • A name of a class

    • A constant value

    • An instance of a class

    • An exception class

    • An imported module 

Ever considered an OpenClassrooms diploma?
  • Up to 100% of your training program funded
  • Flexible start date
  • Career-focused projects
  • Individual mentoring
Find the training program and funding option that suits you best