Answer to Question #247894 in Python for Doug

Question #247894

call this function

def test_sqrt():

a = 1

while a < 26:

print('a =', a,'| my_sqrt(a) =',my_sqrt(a),'| math.sqrt(a) =', math.sqrt(a),'| diff =', abs(math.sqrt(a)-my_sqrt(a)))

a = a + 1

return 0


1
Expert's answer
2021-10-07T03:04:44-0400
import math
def test_sqrt():
  a = 1
  while a<26:
    print('a =', a,'| my_sqrt(a) =',my_sqrt(a),'| math.sqrt(a) =', math.sqrt(a),'| diff =', abs(math.sqrt(a)-my_sqrt(a)))
    a = a + 1
  return 0
if __name__ == "__main__":
  test_sqrt()

my_sqrt() is user defined function which user didn't added in question. This code is running once user will add my_sqrt() function defined by him. Method calling is fine which is asked in question.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS