Python program to find square root of the number using Newton’s method.

Thiru Malai
2 min readJun 8, 2021

Concepts involved

Loop

While loop:

A while loop statement in Python programming language repeatedly executes a target statement as long as a given condition is true.

Syntax:

The syntax of a while loop in Python programming language is −

while(condition)
{
statement(s)
}

while expression:

statements(s)

Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non-zero value. The loop iterates while the condition is true.

When the condition becomes false, program control passes to the line immediately following the loop.

Keywords used

Return:

  • The python return statement is used in a function to return something to the caller program.
  • We can use the return statement inside a function only.
  • In Python, every function returns something. If there are no return statements, then it returns None.
  • If the return statement contains an expression, it is evaluated first and then the value is returned.
  • The return statement terminates the function execution.
  • A function can have multiple return statements. When any of them is executed, the function terminates.
  • A function can return multiple types of values.
  • Python function can return multiple values in a single return statement.

Newton’s Method:

0.5*(approx+n/approx) is the Newton method to find the square root of the number.

CODE:

Output:

Refer GUVI:

--

--