Write a Python program to enter any number and calculate its square root.

PROGRAM

import math
# Input from the user
num = float(input(“Enter any number: “))
# Check if the number is non-negative
if num >= 0:
sqrt = math.sqrt(num)
print(f”The square root of {num} is: {sqrt}”)
else:
print(“Square root of negative number is not defined in real numbers.”)

OUTPUT

TRY THE ABOVE CODE

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.