title: Python - Function - Argument said to be "undefined"
body: <p>I'm currently taking a Python course, and got to the chapter in our book that talks about functions. (Please note, this is my first time learning any programming.)</p>
  
  <p>One of the exercises I'm working on at the moment asks for me to turn a bunch of conditional statements into a function (i.e. generalization).</p>
  
  <p>To make this brief, my problem is this: </p>
  
  <p>After I define a function, let's say like so...</p>
  
  <pre><code>def count_letter(letter,string):
      count = 0
      for letter in string:
          count += 1
      print(count)
  </code></pre>
  
  <p>(That is the work, as far as I can recall, for what I typed up for the problem.)</p>
  
  <p>I run the program, then call the function in the shell as usual...</p>
  
  <p>(Example directly below)</p>
  
  <pre><code>&gt;&gt;&gt; count_letter(a,bananana)
  </code></pre>
  
  <p>And I get the following output...</p>
  
  <pre><code>    Traceback (most recent call last):
    File "&lt;pyshell#3&gt;", line 1, in &lt;module&gt;
      count_letter(a,bananana)
  NameError: name 'a' is not defined
  </code></pre>
  
  <p>My teacher and everyone in our class can't figure out why we're getting such an error. We would understand if it was some other type of an error, but having the shell tell us an argument is 'undefined' (i.e. a variable, as we understand the error) is something we haven't been able to figure out.</p>
  
  <p>We've been staring at the code for a week and still can't figure it out.</p>
  
  <p>Any help would be very appreciated.</p>
  
  <p>Afterthought: I'm trying to count the number of "a"s within "bananana" in the example. Thought I should clear the ambiguity there.</p>