Question: Were going to return to a problem youve seen before, and rewrite it as a function called law_of_cosines(a, b, angleD). However, instead of asking the

Were going to return to a problem youve seen before, and rewrite it as a function called law_of_cosines(a, b, angleD). However, instead of asking the user for input, the function will take 3 arguments, a and b (which are the lengths of those sides, as floats) and angleD (which is the angle between them in degrees, and it can now also be a float). Your function should then calculate the length of side c and return that result. Write a program that computes the length of the third side of a triangle if the lengths of two sides and the angle between them are known. To do this, use the Law of Cosines: if the lengths of two sides are a and b, and the angle between them is , then the length c of the third side is c = (a^2 + b^2 2abcos). Because you are writing this as a function, you dont have to be as careful about the values that you are giving to the variables, but you do have to be aware of what your input values are and what your return value is. Write three additional tests to check your function. Make these new tests, with new variables to store the results (called res2, res3, and res4), dont just change the existing one, so that your program has four lines of output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!