Question: Consider the triangle shown below: C b a B The Law of Cosines can be used to calculate the length C of one side of
Consider the triangle shown below: C b a B The Law of Cosines can be used to calculate the length C of one side of a triangle if the lengths a and b of the other two sides of the triangle are known and if the angle y (gamma) is known. In the special case where a = b (two of the sides of the triangle have the same length) the length of Cis: C 2ab(1 cos(7)) V Write some Python code that computes the value of C. In your code, create some variables a, b, and 7 and set them to some values of your choice (the values 3, 3, and "/3 results in c = 3 because the triangle is an equilateral triangle). You should assume that the person marking your quiz will change these values. You should use the formula shown above (and not some alternative formulation of the Law of Cosines). Your code does not need to test if a real-valued square root exists. You should use the math module to compute the cosine of the angle and the square root
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
