KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Assertion (A): The range() function is a built-in function which is used with the for loop.

Reason (R): This function doesn't require any parameter. It is used in for loop to generate the series such as even and odd numbers, positive and negative numbers, etc.

Based on the above assertion and reasoning, pick an appropriate statement from the options given below:

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true and R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
  5. Both A and R are false.

Python Control Flow

1 Like

Answer

A is true but R is false.

Reason — The range() function is a built-in function used with the for loop to generate a sequence of numbers. In the range() function, the start value and step value are optional because their default values are 0 and 1 respectively. However, the stop value is mandatory. Therefore, the first statement is true but the second statement is false.

Answered By

2 Likes


Related Questions