Computer Science, asked by abdulaleem3548, 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)
by using python

Answers

Answered by viswacps
0

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

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
2

The above code return 12 for the value of h(3231).

Explanation:

  • The above code is in python language which returns the value of n if the 2^{n} is greater than the x value which is taken by the function "h" as an argument.
  • The above code continues the process until the value of 2^{n} is less than or equal to the value of x, but if the value of 2^{n} is greater than the value of x. Then the value of n is returned.
  • For example if the user pass 3231 for the x variable then it returns 12 because 2^{12} is greater than 3231, but the value of 2^{11} is less than 3231

Learn More:

  • Python program : https://brainly.in/question/5558161
Similar questions