Informatics Practices
Assertion (A): When a set of statements is indented under the same block, starting from the same indentation, it is said to be a compound statement.
Reasoning (R): Compound Statement begins with a header ending with a colon (:) sign and the statements under the same indentation are marked as a block.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Control Flow
1 Like
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
A compound statement in Python is formed when multiple statements are grouped together under the same block of indentation. The header line begins with a keyword and ends with a colon (:). Subsequent statements that are indented under the same level are considered part of the block.
Answered By
3 Likes
Related Questions
Find the output of the following Python program:
for x in range(1, 20, 3): print(x, end =',')- 1,20,3,
- 1,4,7,10,13,16,19,
- 13,6,9,12,15,18,
- 20,40,60,80,100,
if statement comes in which category of statements?
- Sequential statements
- Conditional statements.
- Iterative statements
- Loop statement
Assertion (A): The conditional flow of control is implemented using if statement.
Reasoning (R): A statement or statements (block of code) are indented (usually 4 spaces) inside the if statement and are executed only if the condition evaluates to true, otherwise they are ignored.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): In an if-else statement, the if block checks the true part whereas else checks for the false part.
Reasoning (R): In a conditional construct, else block is mandatory.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.