• 8 heures
  • Facile

Ce cours est visible gratuitement en ligne.



J'ai tout compris !

Mis à jour le 28/03/2024

Apply the PEP 8 Style Guide to Python Code

Compétences évaluées

  • 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 

Et si vous obteniez un diplôme OpenClassrooms ?
  • Formations jusqu’à 100 % financées
  • Date de début flexible
  • Projets professionnalisants
  • Mentorat individuel
Trouvez la formation et le financement faits pour vous