COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Indentation
|
|
Curly Braces
|
|
Parenthesis
|
|
Quotation
|
Detailed explanation-1: -Indentation is used to define a block of code in python. Braces are used to define a block of code in most programming languages, like C, C++, and Java. But this indentation makes python unique among all programming languages. This indentation highlights the block of code.
Detailed explanation-2: -A block is a piece of Python program text that is executed as a unit. The following are blocks: a module, a function body, and a class definition. Each command typed interactively is a block.
Detailed explanation-3: -To indicate a block of code in Python, you must indent each line of the block by the same amount. The two blocks of code in our example if-statement are both indented four spaces, which is a typical amount of indentation for Python.
Detailed explanation-4: -By convention, four space indentation is used in Python. Most Python code editors, including Jupyter notebooks, indent code after if-statements automatically four spaces. In the first line of code in the example above, the variable a is assigned the value 2 . The second line of code is the if-statement.