What is the value of h(6,8) for the function below?def h(m,n): ans = 1 while (n > 0): (ans,n) = (ans*m,n-2) return(ans) | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

What is the value of h(6,8) for the function below?def h(m,n): ans = 1 while (n > 0): (ans,n) = (ans*m,n-2) return(ans)

16th Feb 2018, 3:16 AM
I Am a Baked Potato
I Am a Baked Potato - avatar
2 Réponses
+ 4
The answer is not clear since the idention level of return is not clear.
16th Feb 2018, 6:22 AM
Oma Falk
Oma Falk - avatar
0
Just copy the code into the playground and look what happens 😉
16th Feb 2018, 8:04 AM
Sebastian Keßler
Sebastian Keßler - avatar