方法1:切割法

num = float(input())
zhenShu = float(str(num).split('.')[0])
xiaoShu = num - zhenShu
if xiaoShu >= 0.5:
    print(int(zhenShu)+1)
else:
    print(int(zhenShu))

方法2:调用自带函数

num = float(input())
val = round(num)
if num-val >= 0.5:
    val += 1
print(val)