Ask Question
5 October, 17:16

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

+4
Answers (1)
  1. 5 October, 17:44
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers