title: New to programming and I am having a conceptual block with the range function (explicit values versus iterations)
body: <p>I'm getting confused as to how range works in terms of iterating values.</p>
  
  <p>This is where I all of a sudden had a problem.  Here's the code for sine v. degrees in radians:</p>
  
  <pre><code>for angle in range(10):
      y = math.sin(math.radians(angle))
      print(y)
  </code></pre>
  
  <p>I understand this perfectly.  Python will calculate a sine value for each degree from 0 to 9.</p>
  
  <p>Where I'm having trouble is with this code:</p>
  
  <pre><code>def square(x):
      runningtotal = 0
      for counter in range(x):
          runningtotal = runningtotal + x
  
      return runningtotal
  
  toSquare = 10
  squareResult = square(toSquare)
  </code></pre>
  
  <p>This is simply a code to arrive at a square calculation by summing up 10 10 times to arrive at 100.</p>
  
  <p>The problem I'm having is that in the sine code, when math.sin is called as it goes through the range, it looks at it conceptually as <code>[0,1,2,3,4,5,6,7,....]</code> and calculates the correct sine value for each number until it goes through the range.</p>
  
  <p>But as I look at the squaring code, to me <code>range(x)</code>, where <code>square(ToSquare)</code> is the same as <code>square(10)</code>, should conceptually be equal to <code>[0,1,2,3,4,5,6,7,8,9]</code>.  But clearly the code is looking at is as 10 iterations of the number 10.</p>
  
  <p>Where am I getting confused?</p>