Question: LANG : Python 3 What I have so far is what is shown above. I just can't seem to figure out how to make the

 LANG : Python 3 What I have so far is whatis shown above. I just can't seem to figure out how to

LANG : Python 3

What I have so far is what is shown above. I just can't seem to figure out how to make the "values" follow the steps required.

import math import random number = abs(float(input('Please enter a number: '))); guess = random. randrange(1, number), print('Steps = Value'). print('=' * 40). 20 for steps in range (0, 6): print(int(math.pow(2, steps)), end = " "), for operator in range (1): print(' =', end = " ") for count in range (1): guess = (guess + number / guess) / 2, for i in range (1): print(guess) print('sqrt = ', math. sqrt(number)), 28 print('=' * 40) inrint('Thank you Good Bell + Please enter a number: 4521, Steps = Value ======================================== 1 = 2228.5072935368044 2 = 1115.2680028831683 4 = 559.6608685212065 8 = 283.86948742144494 16 = 149.89791023676747 32 = 90.02921872198891 sqrt = 67.23838189605696 . Thank you, Good Bye! Objective: Practice using looping and the math module with user input. Description: Compute the square root of a number specified by the user using Newton's method for some number of iterations and examine the convergence. Your program must meet the following requirements: 1. Include a multi-line comments at the top of the file with your name, student ID number, course number, and the assignment number. 2. Your program should ask the user for a number as a float. To avoid errors, it should ensure that the value is not negative. 3. It should use the input value to compute the square root using Newton's method and show the results for 1, 2, 4, 8, 16, and 32 steps, as well as the "correct result using math.sqrt(). Hint: Test your code with several values and build up the solution one step at a time. Deadline: Saturday, February 8, 2020, noon (try to finish in class) Example Output: The following is a possible run with example of inputs. Please enter a number: 4321 Steps = Value === ===== ==== === ===== === ===== ==== ==== === = 1 = 1211.8920313790256 = 607.7287652613055 = 160.7375691022556 = 65.73443461354964 = 65.73431371817918 32 = 65.73431371817918 sqrt = 65.73431371817918 ==== ===== === ===== === ===== ==== ==== ===== == Thank you, Good Bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!