Question Detail

COS 102 lecture 4 Objective Question

Question

When using Python's int(x) function for numeric conversion, how is the decimal portion handled?
Options
A It is rounded up to the nearest whole number.
B It is rounded down to the nearest whole number.
C It is truncated, not rounded.
Correct Answer
D It is converted to a string representation.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 43, in the 'Numeric Operations' table for 'Integer Conversion', specifies: "The decimal portion is truncated, not rounded."

Hint

Look at the 'Integer Conversion' row in the 'Numeric Operations' table.

Question Info