for ... in range loop not create correctly : <p>So, I started up with python again a week ago. I'm trying to create a small function that returns triangle numbers up to n. However, I've created a strange glitch in my for loop:</p>

<pre><code>def makeTriangle(s):
    print("S is %d" % s)
    triangle = 0
    for a in range(1,s):
        print("a is: %d " % a)
        triangle = triangle + a
        print("Triangle: %d " % triangle)
        return triangle

n = 3 while n &lt; 10:
    x = makeTriangle(n)
    n+=1
</code></pre>

<p>When I run this a never changes from the value 1 - even though I thought I was creating a list that would iterate up to 'n'. Where am I going wrong?</p>
