import math

toH=0

def name(p):
    o = 10**p
    return o

def NM(D,C):
    y = D
    x = C
    J2=name(x)
    H2=name(-x)
    G2 = math.floor(y*J2)*H2
    if y>0 : 
         if y >= G2 + (0.5 * H2):
             y = G2 + H2
         else:
             y = G2 + 0
    else:
        if y <= G2 - (0.5 * H2):
            y = G2 - H2
        else:
            y = G2 + 0
    print(y)
    toH = y
    return toH

NM(2.6,0)
print(NM(2.6,0))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: