Python Program to find Square root of a Number

Write a Python Program to find the Square root of a Number using the sqrt and pow functions with an example.

This Python program allows the user to enter any integer value. Next, this program finds the square root of that number using a math function called sqrt().

import math

num = float(input(" Please Enter any numeric Value : "))

squareRoot = math.sqrt(num)

print("The Result Of {0}  = {1}".format(num, squareRoot))
Program to find the Square root of a Number using sqrt()

Program to find the Square root of a Number using pow()

In this example program, we use the pow() function to find the square root of a number. Remember, √number = number½.

# Using pow function
import math

number = float(input(" Please Enter any numeric Value : "))

squareRoot = math.pow(number, 0.5)

print("The Square Root of a Given Number {0}  = {1}".format(number, squareRoot))
find the Square root of a Number using math pow() function