google python exercises
<p>I'm watching the instructional videos on you youtube and started doing some of the exercises at <a href="http://code.google.com/edu/languages/google-python-class" rel="nofollow">http://code.google.com/edu/languages/google-python-class</a> but I'm puzzled by the below problem in the string1.py file.
What I can't seem to understand is, what is the "s" in both_ends(s): doing?</p>

<pre><code># B. both_ends
# Given a string s, return a string made of the first 2
# and the last 2 chars of the original string,
# so 'spring' yields 'spng'. However, if the string length
# is less than 2, return instead the empty string.

def both_ends(s):
  # +++your code here+++
  # LAB(begin solution)
  if len(s) &lt; 2:
    return ''
  first2 = s[0:2]
  last2 = s[-2:]
  return first2 + last2
</code></pre>

<p>At the bottom of strings1.py there are some functions:</p>

<pre><code>def main()

    print 'both_ends'
    test(both_ends('spring'), 'spng')

if __name__ == '__main__':
  main()
</code></pre>

<p>So how does the program know to substitute "spring" for (s) or is that not what it's doing? I can post the entire file if need be. It's only 140 lines.</p>
