Question: Ask the user for two inputs : a number , and whether t hey would like to round the number up or down . Then,
Ask the user for two
inputs
:
a number
, and
whether t
hey would like to round
the number
up
or
down
. Then, depending on their choice,
your program
must calculate the rounded number, and print out the result to the screen.
The final
result must be in the form of an integer
(
no decimal point!
).
Your prog
ram should be able to handle both decimals (floats) and whole
numbers (integers) as input. It should also c
orrectly handle negative
numbers
.
Finally, it should print out the
a
ction
it is taking
,
c
hoosing from
:
R
ounding down
R
ou
n
ding up
(
No action take
n
because it is already a
whole number
)
I
nvalid command
HINT
: We highly recommend that you test out integer division, casting, and
any other ide
as you have for this problem in the Python interpreter. Integer
division and floating point numbers interact in ways you might not expect.
(You may
not
import the math library, and you may
not
use the built
-
in
round()
function in this assignment.
Doing
so will earn you 0 points.
)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
