How to draw right angled triangle with python
<pre><code>def drawTri(a):
    b = (a*math.tan(45))
    c = (a/math.cos(45))

    t.forward(a)
    t.left(135)
    t.forward(c)
    t.left(135)
    t.forward(b)
</code></pre>

<p><img src="http://i.stack.imgur.com/anF4W.png" alt="enter image description here"></p>

<p>The problem here is close to that described in <a href="http://stackoverflow.com/questions/32980003/basic-trigonometry-isnt-working-correctly-in-python/32980217">Basic trigonometry isn&#39;t working correctly in python</a></p>

<p>The turtle module uses degrees for angles, the math module uses radians</p>

<p>To calculate the cosine of 45 degrees you can use</p>

<pre><code>math.cos(math.radians(45))
</code></pre>

python turtle-graphics