subject

Encapsulate the following Python code in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. while True:y = (x + a/x) / 2.0if y == x:breakx = yAlso write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math. sqrt(a).a = 1 | my_sqrt(a) = 1 | math. sqrt(a) = 1.0 | diff = 0.0a = 2 | my_sqrt(a) = 1.41421356237 | math. sqrt(a) = 1.41421356237 | diff = 2.22044604925e-16a = 3 | my_sqrt(a) = 1.73205080757 | math. sqrt(a) = 1.73205080757 | diff = 0.0a = 4 | my_sqrt(a) = 2.0 | math. sqrt(a) = 2.0 | diff = 0.0a = 5 | my_sqrt(a) = 2.2360679775 | math. sqrt(a) = 2.2360679775 | diff = 0.0a = 6 | my_sqrt(a) = 2.44948974278 | math. sqrt(a) = 2.44948974278 | diff = 0.0a = 7 | my_sqrt(a) = 2.64575131106 | math. sqrt(a) = 2.64575131106 | diff = 0.0a = 8 | my_sqrt(a) = 2.82842712475 | math. sqrt(a) = 2.82842712475 | diff = 4.4408920985e-16a = 9 | my_sqrt(a) = 3.0 | math. sqrt(a) = 3.0 | diff = 0.0

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, shadow56
Formula that contains a nested function that first calculates the average of the values in range e6: p6 and uses the round function to round that average to the nearest 10 dollars. use -1 for the value of the number digit argument. would the formula be =round(average(e6: p6),0
Answers: 1
image
Computers and Technology, 22.06.2019 08:50, najashohatee1234
Can online classes such as gradpoint track your ip location like if im taking a final and i give somebody else my account and they take the final for me will it show where they are taking the final from? and can this be countered with a vpn
Answers: 1
image
Computers and Technology, 23.06.2019 06:00, hilarydodard7099
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
image
Computers and Technology, 23.06.2019 16:30, vitothebest1
You have read about the beginnings of the internet and how it was created. what was the internet originally created to do? (select all that apply) share research. play games. communicate. share documents. sell toys
Answers: 1
You know the right answer?
Encapsulate the following Python code in a function named my_sqrt that takes a as a parameter, choos...

Questions in other subjects:

Konu
Chemistry, 26.11.2020 18:20
Konu
Mathematics, 26.11.2020 18:20
Konu
English, 26.11.2020 18:20
Konu
Biology, 26.11.2020 18:20