【发布时间】:2018-05-13 08:00:09
【问题描述】:
我打算打印用户打算在输出中打印最多 4 位小数的第四位数 如何在不使用 Round() 函数的情况下获得最多四位小数?
import math
n = int(input('Do you want to calculate the root of a few numbers? --> '))
for i in range(n):
usrinp = int(input('Enter the number for root --> '))
x = math.sqrt(usrinp)
print(x)
例如:
你想计算几个数字的根吗? --> 4
输入根号 --> 1
输入根号 --> 2
输入根号 --> 3
输入根号 --> 19
输出:
1.0000
1.4142
1.7320
4.3588
【问题讨论】:
-
请在您的问题中添加一些示例输入和预期输出。并告诉我们您的代码有什么问题?
-
关于您的要求,我已经编辑了我的问题。
-
我是 Python 的初学者,完全使用我的所有功能对我来说有点困难。
标签: python python-3.x