Informatics Practices
Assertion (A): Indentation is a very important factor while writing a program in Python.
Reasoning (R): Indentation refers to the spaces at the beginning of a code line. Multiple statements with the same indent are classified as a block of code.
- 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
2 Likes
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Indentation is a very important factor while writing a program in Python because it defines the structure and grouping of code blocks. Indentation refers to the spaces at the beginning of a code line, and multiple statements with the same indent level are classified as a block of code.
Answered By
1 Like
Related Questions
Assertion (A): The range() method is used with both for and while loops.
Reasoning (R): By default, the values for start and step are 0 (zero) and 1 (one), respectively.
- 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): The for loop is described as finite loop and while loop is described as unknown or indefinite iterative construct.
Reasoning (R): You cannot use while loop for menu-driven programs.
- 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.
What are compound statements?
Construct a logical expression to represent each of the following conditions:
(a) Marks are greater than or equal to 70 but less than 100.
(b) Num is between 0 and 5 but not equal to 2.
(c) Answer is either 'N' OR 'n'.
(d) Age is greater than or equal to 18 and gender is male.
(e) City is either 'Kolkata' or 'Mumbai'.