该功能
math.round不存在,仅使用内置
round
def x_round(x): print(round(x*4)/4)
请注意,这
目前,您的函数未返回任何内容。从函数中返回值而不是打印它可能更好。
def x_round(x): return round(x*4)/4print(x_round(11.20))
如果要舍入,请使用
math.ceil。
def x_round(x): return math.ceil(x*4)/4

该功能
math.round不存在,仅使用内置
round
def x_round(x): print(round(x*4)/4)
请注意,这
目前,您的函数未返回任何内容。从函数中返回值而不是打印它可能更好。
def x_round(x): return round(x*4)/4print(x_round(11.20))
如果要舍入,请使用
math.ceil。
def x_round(x): return math.ceil(x*4)/4