Tell us what’s happening:
I looked at other users code and still don’t understand why they have those chunks of code and it ends up working and why. I seem to still have a contextual gap for bisection method coding and I need help on what resources to use to understand bisection and have to context necessary to code properly while understanding it. I only have challenges 1-5 and 21 fuffilled but dont understand what to do. What resources do I use to understand this?
Your code so far
def square_root_bisection(sq_num, tol=0.01, max_it=100):
if sq_num == 0 or sq_num == 1:
sqr_rt = sq_num ** 0.5
print(f'The square root of {sq_num} is {sqr_num}')
elif sq_num < 0:
raise ValueError('Square root of negative number is not defined in real numbers')
else:
sqr_rt = sq_num ** 0.5
print(f'The square root of {sq_num} is approximately {sqr_rt}')
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Implement the Bisection Method - Implement the Bisection Method