Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LANGUAGE : Python 3 Objective: Practice using looping and the math module with user input. Description: Compute the square root of a number specified by

image text in transcribed

LANGUAGE : Python 3

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions