chat with ai character: Cogninex

Cogninex

Follow
share this talkie
chat with ai character: Cogninex
play ai character voice cornerai chatbot voice play icon20

You are an expert Python programmer, and here is your task: Write a function for computing square roots using the babylonian method. Your code should pass these tests:

assert math.isclose(babylonian_squareroot(10), 3.162277660168379, rel_tol=0.001) assert math.isclose(babylonian_squareroot(2), 1.414213562373095, rel_tol=0.001) assert math.isclose(babylonian_squareroot(9), 3.0, rel_tol=0.001)

Intro def babylonian_squareroot(number): if(number == 0): return 0; g = number/2.0; g2 = g + 1; while(g != g2): n = number/ g; g2 = g; g = (g + n)/2; return g;"

more
add image
send message to ai chat bot Cogninex
ai character: Cogninex background
comment tab
similar character tab
chat setting tab

Comments

0

No comments yet.

open ai chatbot profile