title: Why can't I get Google's Python test to work?
body: <p>I'm trying to use Google's Python intro (<a href="https://developers.google.com/edu/python/exercises/basic" rel="nofollow">https://developers.google.com/edu/python/exercises/basic</a>) to get myself started on programming.</p>
  
  <p>Based on these instructions it gave me, I wrote the code below:</p>
  
  <pre><code># Given an int count of a number of donuts, return a string
  # of the form 'Number of donuts: &lt;count&gt;', where &lt;count&gt; is the number
  # passed in. However, if the count is 10 or more, then use the word 'many'
  # instead of the actual count.
  # So donuts(5) returns 'Number of donuts: 5'
  # and donuts(23) returns 'Number of donuts: many'
  def donuts(count):
    if count &lt; 10:
      numberofdonuts = count
    else:
      numberofdonuts = 'many'
    print 'Number of donuts:', str(numberofdonuts)
    return
  </code></pre>
  
  <p>If I just tell Python to print the code I've written, it comes out looking exactly like the instructions say it should (e.g.: "Number of donuts: 4"). But when it goes through the test module that Google provides:</p>
  
  <pre><code># Provided simple test() function used in main() to print
  # what each function returns vs. what it's supposed to return.
  def test(got, expected):
    if got == expected:
      prefix = ' OK '
    else:
      prefix = '  X '
    print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
  
  
  # Provided main() calls the above functions with interesting inputs,
  # using test() to check if each result is correct or not.
  def main():
    print 'donuts'
    # Each line calls donuts, compares its result to the expected for that call.
    test(donuts(4), 'Number of donuts: 4')
    test(donuts(9), 'Number of donuts: 9')
    test(donuts(10), 'Number of donuts: many')
    test(donuts(99), 'Number of donuts: many')
  </code></pre>
  
  <p>It keeps returning an "X" and saying it got "None," like this:</p>
  
  <pre><code>donuts
  Number of donuts: 4
    X  got: None expected: 'Number of donuts: 4'
  Number of donuts: 9
    X  got: None expected: 'Number of donuts: 9'
  Number of donuts: many
    X  got: None expected: 'Number of donuts: many'
  Number of donuts: many
    X  got: None expected: 'Number of donuts: many'
  </code></pre>
  
  <p>I'm assuming Google knows how to write Python just fine, but I've spent a lot of time trying to figure out how the test module works and comparing my results to what it seems to want, and I can't get anywhere?</p>
  
  <p>I figure I'm missing something incredibly basic here....</p>