Home>
I want to achieve

I wrote the code to round up the decimals, but the execution result is as follows.

b = 2.5
b = 2.5


What i want to ask

b = 2.5
b = 3


is.
Please tell me what to do.

code
import math
a = 5
b = a/2.0
print ("b =", b)
math.ceil (b)
print ("b =", b)
  • Answer # 1

    b = math.ceil (b)

    Please.
    I have thrown away the calculation result

  • Answer # 2

    print ("b =", math.ceil (b))What is that?

  • Answer # 3

    p.py

    import math
    a = 5
    b = a/2.0
    print ("b =", b)
    print ("math.ceil (b) =", math.ceil (b)))
    bx = math.ceil (b)
    print ("bx =", bx)

    Execution example