Objective
Create a Python program that rounds a decimal number in three different ways with the math module.
Instructions
- Read a decimal number.
- Show
Floor: N, the largest integer that does not exceed the number (math.floor). - Show
Ceiling: N, the smallest integer that is not less than the number (math.ceil). - Show
Truncated: N, the number without its decimal part (math.trunc). - Notice the difference between floor and truncation with negative numbers.
3.7
Floor: 3
Ceiling: 4
Truncated: 3
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise