math.cos(x) not returning correct value?
<p>I just started using python, and am having difficulty with a very basic program. I want to calculate the cosine of -20 degrees. It is my understanding that the default value is in radians, so this is the following code i tried:</p>

<pre><code>import math 


print math.cos(math.degrees(-20))
</code></pre>

<p>This outputs (-.7208...), where the answer is actually (.9397...). I'm sure this has a pretty basic solution but I've tried so many different things and it will not output the correct results. Thanks in advance!</p>

<p>You need to input in radians, so do </p>

<pre><code>math.cos(math.radians(-20))
</code></pre>

<p>math.radians(-20) converts -20 degrees to radians.</p>

python math trigonometry