Open1

Pythonで任意の桁で切り捨て、切り上げ

sho_ichisho_ichi
def roundDown(num, digit):
    return num//(10**digit) * (10**digit)

print(roundDown(175, 2))  # 100


def roundUp(num, digit):
    return (num + 10**digit - 1)//(10**digit) * (10**digit)
    
print(roundUp(175, 3))  # 1000

もっと良い方法間違いなくある