+ 1
¿Por qué result = 1? -- ¿Why result = 1?
def raiz(x, y): result = 1 for i in range(y): result = result * x return result print(raiz(2, 3)) https://code.sololearn.com/c0Qjh4wDckL3/?ref=app
2 Réponses
+ 3
Suppose result was 0 in the beginning:
0 * x * x * ...
would be = 0
So you need to initialize result as 1
+ 2
Thanks so much, i want to live of this xd