Geography, asked by huvassha4700, 8 months ago

What does h(19685) return for the following function definition?

def h(x): (d,n) = (1,0) while d <= x: (d,n) = (d*3,n+1) return(n)​

Answers

Answered by Shraddharan8223
2

Answer:

Answer is 25

the while loop will run 25 times

as 31415927 / 2**24 =1.8... which is > 1

so for last time it will go

for 2**25 , d will be incremented 24+1=25

then it becomes less than 1

condition becomes false... while loop terminates

-->the no. of times x is divided by 2 & remains >1

the d will be incremented by 1

Plz follow me and mark as brainliest

Similar questions