Write the code to input a number and print the square root. Use the absolute value function to make sure that if the user enters a negative number, the program does not crash.
import math
n = float(input("Enter the number N: "))
print("The square root of N is", math.sqrt(abs(n)))
Comments
Leave a comment