Question discussion

Which of the following does Python use to define a block of code, for example the body of a function or a loop?

2549Medium DSSSB TGT Computer Science 0 replies

Which of the following does Python use to define a block of code, for example the body of a function or a loop?

  • ACurly braces { }
  • BThe keywords begin and end
  • CSemicolons
  • DIndentation
Correct answer: D

Explanation

Python marks a block only by indentation, so all the statements of one block must be indented equally, whereas C, C++ and Java use braces.

Discussion 0

Nobody has replied yet. Start the discussion!