Case of Python opening multiple square roots
- 2021-09-24 23:02:34
- OfStack
As shown below:
result = value ** (1 / root)
The third root of 8 is 8 ** (1/3)
The result is 2.0
Supplement: python opens any number to any power
I won't talk too much, let's just look at the code ~
```python
def Evolution():
a = int(input(" Please enter the number of prescriptions you want to prescribe :"))
b = int(input(" Please enter how many times do you want to open it "))
x = int(input(" Estimated value :"))
# b1 1 Intermediate variables , Convenient to use below
b1 = b - 1
while True:
print(x)
y = (b1 * x + a / (x ** b1)) / b
if y == x:
break
x = y
Evolution()