Ask Question
18 November, 21:28

2.4 Code Practice: Question 1 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. Example: Enter a number: - 16. Output 4.0

+5
Answers (1)
  1. 18 November, 22:03
    0
    import math

    num=int (input ("Enter a number: "))

    x=math. fabs (num)

    y=math. sqrt (x)

    print (y)

    Explanation: It will get the square root, then it will get the absolute value of the square root.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “2.4 Code Practice: Question 1 write the code to input a number and print the square root. Use the absolute value function to make sure that ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers