题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
取近似值的方法:
思路:可以浮点数加0.5之后取整即可。。。
num1_float= float(input('')) # 输入数据保存在变量中
num1_near_int = int(num1_float + 0.5) # 关键算法:+0.5取整获得结果
print(f'{num1_near_int}') # 输出
注意不要写多个提示语,会影响反映速率以及执行时间
海康威视公司福利 1407人发布
