Question Detail

COS 102 lecture 4 Objective Question

Question

What does the // operator perform in Python?
Options
A Regular division, always returning a float.
B Exponentiation.
C Floor division, returning the quotient left after removing decimal numbers.
Correct Answer
D Modulus, returning the remainder of a division.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 42, in the 'Arithmetic Operators' table, defines '// Division' as 'division of operands where the solution is a quotient left after removing decimal numbers.' Page 43 further clarifies it returns 'the first integer less than or equal to the quotient'.

Hint

Consult the 'Arithmetic Operators' table on page 42 or the 'Numeric Operations' table on page 43 for the description of '//'.

Question Info