New course! Every coder should learn Generative AI!
Try a free lesson+ 3
def nthRoot(x, n=2):
return x**(1/n)
print(nthRoot(27, 3))
>>>output: 3
print(nthRoot(16))
>>>output: 4
(n is automatically set to 2 if not declared as an argument)
+ 2
This code does that, but it uses taylor-polynomes, which can be quite hard, but taylor-polynomes are awsome!!! 😄
You should check it out on wikipedia (or some where else).
https://code.sololearn.com/cs5g4ro90M55/?ref=app
- 1
Is this is a question