Python Programming: Square root of a number

Example

Input 
enter the number 25 
Output 
The squared root number is 5

Required to Know

Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like print(), and input(), Use of Math module and the use of function sqrt(), and Use of Data types.

Steps

  • Take a squared number as input from the user.

  • Import the math module and use the sqrt function for finding the square root value.

  • Print the square root of the number.

Program

#Import Math module 
import math
# Get the number from the user.
num = int(input("Enter a number: "))
# Calculate the square root of the number.
squared_root = math.sqrt(num)
# Print the square root.
print("The square root of the number is", squared_root)