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

Sowmiya Mai M S
2 min readJun 5, 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 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.

Flow chart

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.

To know more about Python programming, login to Guvi.

Here’s a python code to find the square root of a number using Newton’s method which will be useful to you guys.

Code

Output

In the above program, I have found out the square root for the number 64.

To know more about python programming, login to Guvi

Reference link:https://www.guvi.in/category?search=Python

--

--

No responses yet