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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
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
question
Mathematics, 02.04.2021 19:50
question
Mathematics, 02.04.2021 19:50
Questions on the website: 13722362