
python中平方根
Hello everyone, in this tutorial, I’ll show 3 ways to find square root in Python.
大家好,在本教程中,我将展示3种在Python中找到平方根的方法。
Let’s see how to do it.
让我们来看看如何做。
1. Using Exponent
1.使用指数
number = int(input("enter a number: "))
sqrt = number ** 0.5
print("square root:", sqrt)
Output:
输出:
enter a number: 64 square root: 8.0
输入数字:64 平方根:8.0
In above program, first we’re taking a number from user as input and the entered value will be converted to