Computer Science, asked by udayeni508, 10 months ago

What does h(3231) return for the following function definition?
def h(x):
(m,a) = (1,0)
while m <= x:
(m,a) = (m*2,a+1)
return(a)​

Answers

Answered by viswacps
2

Explanation:

it is the answer so it is the answer as it is the answer that's why it's the answer finally it's only the answer

Answered by AskewTronics
1

It returns 12 for the value of 3231.

Explanation:

  • The above question code is in python language, in which the code takes a value n and then count the 2^{i} for every, 'i' value (starting from 1) until the result is less than the n.
  • For example, if the user gives input as 3231, then the output is 12.
  • It is because when we find the 2^{i} for every value of 'i' (starting from 1) and ending on the result value, which is less than 3231 then the result of 2^{i} is "2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096" which is 12.
  • But when we find 2^{13},  then it will be greater than 3231.
  • Hence the answer is 12.

Learn More:

  • Python : https://brainly.in/question/14689905
Similar questions