H13-311_V3.5 · Question #215
How many spaces does PEP 8 stipulate that Python's first fine indentation needs to indent?
The correct answer is C. 4. PEP 8, Python's official style guide, stipulates 4 spaces per indentation level as the standard for Python code, making C the correct answer. Option A (1 space) is technically valid Python but makes code nearly unreadable and is explicitly discouraged. Option B (2 spaces) is…
Question
How many spaces does PEP 8 stipulate that Python's first fine indentation needs to indent?
Options
- A1
- B2
- C4
- D8
How the community answered
(39 responses)- A13% (5)
- B5% (2)
- C79% (31)
- D3% (1)
Explanation
PEP 8, Python's official style guide, stipulates 4 spaces per indentation level as the standard for Python code, making C the correct answer. Option A (1 space) is technically valid Python but makes code nearly unreadable and is explicitly discouraged. Option B (2 spaces) is common in other languages like JavaScript but is not the PEP 8 recommendation for Python. Option D (8 spaces) was historically used in some Unix/C traditions but creates excessive horizontal nesting in Python. A helpful memory tip: think of the 4 in "Python" - both have four letters in their core identity (Py-th-on = 6, but PEP 8 → 8 ÷ 2 = 4), or simply remember "Python = 4 spaces" as a direct association.
Topics
Community Discussion
No community discussion yet for this question.