Ask Question
9 August, 10:48

Write a script that will:

• Call a function to prompt the user for an angle in degrees.

• Call a function to calculate and return the angle in radians. (Note: π radians = 180°)

• Call a function to print the resultWrite all of the functions, also. Put the script and all functions in separate code files.

+1
Answers (1)
  1. 9 August, 14:35
    0
    The solution code is written in Python:

    import math def getUserInput () : deg = int (input ("Enter an angle in degree: ")) return deg def calculateRad (deg) : return (deg * math. pi) / 180 def printResult (deg, rad) : print (str (deg) + " is equal to " + str (round (rad, 2)) + " radian") degree = getUserInput () radian = calculateRad (degree) printResult (degree, radian)

    Explanation:

    Since we need a standard Pi value, we import math module (Line 1).

    Next, create a function getUserInput to prompt user to input degree (Line 3-5).

    Next, create another function calculateRad that take one input degree and calculate the radian and return it as output (Line 7-8).

    Create function printResult to display the input degree and its corresponding radian (Line 10-11).

    At last, call all the three functions and display the results (Line 13-15).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a script that will: • Call a function to prompt the user for an angle in degrees. • Call a function to calculate and return the angle ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers