Question: Write a function that computes th nth root of a number, where n can be an integer from 2-9. Your function should be named calculate_root,
end Now, it's your turn (again). Write a function that computes the nth root of a number, where n can be an integer from 2 to 9. Your function should be named calculate root, take two input arguments (n and the number to take the root of), and return a statement giving the result. Your input and output in the Command Window should look like this: > calculate root (2,16) The square root of 16.0000 is 4.0000 >> calculate root (3,27) The cube root of 27.0000 is 3.0000 >> calculate root (4,16) The fourth root of 16.0000 is 2.0000 Think about the limits on the roots allowed. How can you ensure that the input values for n are from 2 to 9 only? Return an error if somebody tries to take a root that's less than 2, greater than 9, or not an integer Are there other limitations on roots? Build in errors (with informative messages) to catch them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
