KnowledgeBoat Logo
|

Informatics Practices

Assertion (A): Floor division operator (//) in Python is different from division operator.

Reasoning (R): Consider the given two statements:

>>>10//3 will give the output as 3.

On the other hand,

>>>10/3 will give the output as 3.3333333333333335

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

Python Funda

1 Like

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
In Python, the floor division operator (//) performs integer division. On the other hand, the division operator (/) performs float division. For example, the statement 10 // 3 will give the output 3, whereas 10 / 3 will give the output 3.3333333333333335.

Answered By

2 Likes


Related Questions