1. Home
  2. Data Science
  3. Python
  4. According to PEP 8, how many spaces should be used for…

Added 2 Nov 2026

According to PEP 8, how many spaces should be used for each indentation level?

  1. 8
  2. 2
  3. 1
  4. 4 Correct answer

Correct answer

D. 4

16 views

MCQSEXAM

Explanation

PEP 8, Python's style guide, recommends 4 spaces per level and no tabs mixed with spaces. Tools such as black and flake8 enforce it automatically.

Reference

Asked in: NTS, Python Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs