题解 | #单组_保留小数位数#
单组_保留小数位数
https://www.nowcoder.com/practice/a4bccea7f4644fbda1208f8e0d397bab
# 读取输入 n = float(input().strip()) # 使用round函数四舍五入到3位小数 rounded_n = round(n, 3) # 使用格式化字符串确保输出为3位小数(包括末尾的0) formatted_n = "{:.3f}".format(rounded_n) # 输出结果 print(formatted_n)#python#