Question 32: Write a Program to find the Square Root of a Number in Python
Solution 1:
'''
Python Program 32: A
Find the Square Root of a number using
using math sqrt() function
Author: Code2care.org
Version: v1.0
Date: 8 July 2023
'''
import math
number = 64
square_root = math.sqrt(number)
print(square_root)
Output: 8.0
Solution 2:
'''
Python Program 32: B
Find the Square Root of a number using
using exponentiation operator
Author: Code2care.org
Version: v1.0
Date: 8 July 2023
'''
number = 900
square_root = number ** 0.5
print(square_root)
Output: 30.0
Solution 3:
'''
Python Program 32: C
Find the Square Root of a number using
using pow() function
Author: Code2care.org
Version: v1.0
Date: 8 July 2023
'''
number = 4
square_root = pow(number,0.5)
print(square_root)
Output: 2.0
Docs:
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!