32: Python Program to Find Square Root of a Number


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


Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap