nerdexam
Huawei

H13-311_V3.5 · Question #70

Python authors deliberately design very restrictive grammars that make bad programming habits (such as the next line of if statement not indented to the right) cannot be compiled

The correct answer is A. True. Option A is correct because Python enforces indentation as a core part of its syntax, not merely as a style convention. Guido van Rossum deliberately designed Python this way so that code blocks (like the body of an if statement, loop, or function) must be consistently…

AI Overview

Question

Python authors deliberately design very restrictive grammars that make bad programming habits (such as the next line of if statement not indented to the right) cannot be compiled

Options

  • ATrue
  • BFalse

How the community answered

(27 responses)
  • A
    70% (19)
  • B
    30% (8)

Explanation

Option A is correct because Python enforces indentation as a core part of its syntax, not merely as a style convention. Guido van Rossum deliberately designed Python this way so that code blocks (like the body of an if statement, loop, or function) must be consistently indented, or the interpreter raises an IndentationError and refuses to run the program. This is different from languages like C or Java, where indentation is optional and purely cosmetic. Option B is wrong because Python does not simply warn about bad indentation - it treats it as a hard grammar violation that prevents execution. Memory tip: think of Python as "whitespace-sensitive" - the space before your code is part of the language itself, not decoration.

Topics

#Python syntax#Indentation enforcement#Language design philosophy#Code style

Community Discussion

No community discussion yet for this question.

Full H13-311_V3.5 Practice