Hello everyone, welcome to **nkcoderz.com**. In this article we will going to discuss about Python program To Convert Hexadecimal To Decimal.

Table of Contents

## Code For python program to find the square root of the given number without a square-root function

```
def square_root(num):
approx = num/2
while abs(approx*approx - num) > 0.01:
approx = (approx + num/approx)/2
return approx
# Test the function
print(square_root(10))
```

## Output

`3.162`

## Explanation

The program defines a function `square_root`

that takes a number as an argument (`num`

) and returns its square root. This function makes use of the Newton-Raphson method to approximate the square root.

The initial approximation is set to the value of `num`

divided by 2. The function then enters a loop that continues to run until the difference between the approximation squared and the original number is less than a certain tolerance (0.01 in this case).

In each iteration, the approximation is updated by using the formula: `(approx + num/approx) / 2`

The loop terminates when the difference between the approximation squared and the original number is within the desired tolerance and the approx value is returned as the square root.

Python Program To Convert Hexadecimal To Decimal

## Conclusion

Both the above methods will work and give the same result, you can choose the one you are more comfortable with.