# Computer Science

Answer the following question without running the code. The procedure isMyNumber is used to hide a secret number (integer). It takes an integer x as a parameter and compares it to the secret number. It returns:

-1 if the parameter x is less than the secret number

0 if the parameter x is correct

1 if the parameter x is greater than the secret number

The following procedure, jumpAndBackPedal, attempts to guess a secret number. The only way it can interact with the secret number is through the isMyNumber procedure explained above.

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
'''
guess = 1
if isMyNumber(guess) == 1:
return guess
foundNumber = False
sign = isMyNumber(guess)
if sign == -1:
guess *= 2
else:
guess -= 1
return guess
Unfortunately, the implementation given does not correctly return the secret number. Please fix the errors in the code such that jumpAndBackpedal correctly returns the secret number.

1. 0
2. 0
3. 14
1. 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
'''

guess = 1
foundNumber = False
sign = isMyNumber(guess)
if sign == -1:
guess *= 2
elif sign == 1:
guess -= 1
elif sign == 0:
foundNumber =True
return guess

1. 0
2. 0
posted by cool
2. 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
'''
if isMyNumber(0) == 1:
return 0
guess = 1;
foundNumber = False
sign = isMyNumber(guess)
if sign == -1:
guess *= 2
elif sign == 1:
guess -= 1
else:
foundNumber = True;
return guess

1. 0
2. 0
posted by Hervé

## Similar Questions

1. ### Medical Coding ICD-9-CM

A 75-year-old male presented to the ambulatory surgical unit for a cystoscopy. The patient's complaint was hematuria. A transurethral diagnostic cystoscopy was performed. No acute or abnormal findings were determined to be the
2. ### medical coding

what is the corresponding HCPCS Level II code for HCPCS Level I code 96360? a. S9373 b. S9374 c. S9376 d. S9375 In what category do you code administration of Procit if not identified by Levels I or II? a. A codes b. G codes c. J
3. ### MEDICAL CODING

Use the CPT, ICD-9-CM, and ICD-10-CM manuals to assign the appropriate procedure, modifier, and diagnosis codes to the following case scenario. Preoperative Diagnosis: Right Pneumothorax Postoperative Diagnosis: Same Procedure
4. ### reimbursement methodologies

you are a third-party payer performing medical records review your job is to match codes submitted to claims , you see a code for a colonoscopy procedure but you don't see the procedure report anywhere in the record , as
5. ### medical billing and coding

This 35-year-old female patient has carcinoma of the upper-outer left breast. She had a lumpectomy performed and a sentinel lymph node biopsy of the axillary lymph node. The pathology report for the lymph node states no
6. ### Medical Billing & Coding

This 32-year-old female patient was admitted with intractable partial epilepsy after an MRI showed mesial temporal sclerosis on the right side with hippocampal atrophy. The neurosurgeon carried out a selective
7. ### medical billing and coding

you work for a third party payer performning medical records review. your job is to match codes that were submitted on the claim to documentation in the medical record. you notice that a code has been input for a colonoscopy
8. ### pseudo code algorithm

Convert your algorithm from Question One into a complete Java application. Marks will be allocated based upon: ● Your Java code matching your pseudo code algorithm from Question One. ● Your Java code being syntactically
9. ### Science

how does the initial procedure compare to your updated procedure? What changes did you have to make? Why? How can I answer this question? Please help me... ;(
10. ### Medical Billing & Coding

This patient was admitted when MRI revealed cerebral aneurysm. After admission, a cerebral angiogram was performed and showed nonruptured arteriosclerotic aneurysm of the anterior cerebral artery. An aneurysmectomy by anastomosis

More Similar Questions