どの値を代入しても一番下の行でelseになってしまいます。
Enter the starting salary: 150000
を代入すると、
Best savings rate: 0.4411
Steps in bisection search: 12 になるそうです。
```ここに言語を入力
annual_salary=float(input("Enter your annual salary:"))
total_cost=1000000
semi_annual_raise=0.07
portion_down_payment=0.25
monthly_salary=annual_salary/12
down_payment=total_cost*portion_down_payment
current_savings=0
r=0.04
mo=0
num_guesses = 0
low = 0
high = 1
while (True) :
guess = (high + low)/2
for mo in range(36):
mo+=1
current_savings=current_savings+monthly_salaryguess+current_savingsr/12
if(mo%6==0):
monthly_salary=monthly_salary+monthly_salary*semi_annual_raise
m=down_payment
n=current_savings
if(m-n < 0 and guess >= 1):
break
if(m-n < 0 and guess < 1):
low = guess
if(m-n > 100):
high = guess
if(0 <= m-n <= 100):
num_guesses += 1
break
current_savings=0
monthly_salary=annual_salary/12
mo=0
if(guess < 1):
print('Best savings rate:',guess)
print('Steps in bisection search:',num_guesses)
else:
print('It is not possible to pay the down payment in three years')