Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

def jumpAndBackpedal(isMyNumber): ''' isMyNumber: Procedure that hides a secret number. It takes as a parameter one number and returns: * -1 if the number is less than the secret number * 0 if the number is equal to the secret number * 1 if the number is greater than the secret number returns: integer, the secret number ''' Pls correct the code such that it only return the secret number

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SIGN UP FOR FREE
It is a Python code.
It is not exactly clear what is intended here but here is some code that you should be able to adapt to do what you need. It tries to guess the number in num that is between 0 and 100. import random num = random.randrange(101) def secretNum(guess): if guess < num: return -1 elif guess == num: return 0 else: return 1 def jumpAndBackpedal(isMyNumber): min_guess = 0 max_guess = 100 done = False while not done: guess = (max_guess + min_guess) // 2 print(max_guess, min_guess, guess) res = isMyNumber(guess) if res == -1: min_guess = guess elif res == 1: max_guess = guess else: done = True return guess print("Secret Number was:", jumpAndBackpedal(secretNum))

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question