Question: Exercise 7.2 (calculator.py) Write a small calculator that can compute arcsin, arccos, arctan and square root of a number. Use math.sqrt), math.asin), math.acosO, and math.atan().
Exercise 7.2 (calculator.py) Write a small calculator that can compute arcsin, arccos, arctan and square root of a number. Use math.sqrt), math.asin), math.acosO, and math.atan(). Remember to import math. Make sure to check for each function that the input is valid Function math.sqrtO non-negative math.asin) between -1 and 1 math.acos ) between -1 and 1 math.atan) any number Valid Input Should be 12 CSE/IT 107L Lab 2: Code Style and Conditional Execution 1 $ python3 calculator.py 2 Enter a number to use: 16 Which operation? sqrt (s), arcsin (a), arccos (c), arctan (t): s The aquare root of the input is s 4.0 6 $ python3 calculator.py 7 Enter a number to use: 1.1 s Which operation? sqrt (s), arcsin (a), arccos (c), arctan (t): a Input should be between -1 and 1 python3 calculator.py Enter a number to use: 0.5 12 Which operation? sqrt (s), arcsin (a), arccos (c), arctan (t) a 13 The arcsine of the input is 14 0.5235987755982989 15 $ Python3 calculator . Py 6 Enter a number to use: 1000 17 Which operation? sqrt (s), arcsin (a), arccos (c), arctan (t): t 18 The arctangent of the input is 19 1.5697963271282298
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
