curriculum/challenges/english/blocks/learn-the-bisection-method-by-finding-the-square-root-of-a-number/65ef1a50049cf9bada13266f.md
Create an elif statement to check if square_target is equal to 0. If it is, assign the value 0 to the root variable. Also, print the message 'The square root of {square_target} is 0'. Remember to format the message using an f-string.
You should have an elif statement to check the condition square_target == 0.
({
test: () =>
{
assert(runPython(`_Node(_code).find_function("square_root_bisection").find_ifs()[1].find_conditions()[1].is_equivalent("square_target == 0")`));
}
})
You should assign the value 0 to the root variable and pass the argument f'The square root of {square_target} is 0' to a print call.
({
test: () =>
{
assert(runPython(`_Node(_code).find_function("square_root_bisection").find_ifs()[1].find_bodies()[1].is_equivalent("root = 0\\nprint(f'The square root of {square_target} is 0')")`));
}
})
--fcc-editable-region--
def square_root_bisection(square_target, tolerance=1e-7, max_iterations=100):
if square_target < 0:
raise ValueError('Square root of negative number is not defined in real numbers')
if square_target == 1:
root = 1
print(f'The square root of {square_target} is 1')
--fcc-editable-region--