1. Home
  2. Data Science
  3. Python
  4. How does Python define a block of code such as a loop body…

Added 25 Nov 2026

How does Python define a block of code such as a loop body or function body?

  1. By curly braces {}
  2. By begin/end keywords
  3. By semicolons
  4. By indentation Correct answer

Correct answer

D. By indentation

5 views

MCQSEXAM

Explanation

Python uses consistent indentation to define code blocks instead of braces.

Reference

Asked in: Python Interview Basics

https://docs.python.org/3/tutorial/introduction.html

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