Practice mode Python

In Python 3, what is the value of 7 / 2?

Correct answer C. 3.5

Explanation

In Python 3 the / operator always performs true division and returns a float, so 7 / 2 is 3.5. Floor division is written //, which gives 3. In Python 2, / between two integers performed floor division, one of the major changes introduced by Python 3.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.