题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
1. 将输入的浮点数分为整数z和小数x部分
2.如果小数部分小于0.5则输出整数z,否则输出整数z+1
num_in = float(input()) num_in_z = num_in // 1 num_in_x = num_in - num_in_z if num_in_x >= 0.5: print(int(num_in_z+1)) else: print(int(num_in_z))