The return value should be a list but doesn't return as expected?! - Python newbie
<p>This must be a very simple solution that has eluded me this last hour.  I've tried to build this test function where the return value of the test_cases list should match the values in the test_case_answers list but for some reason, test case 1 and test case 2 fail.  When I print the return values for the test cases they return the correct answers, but for some reason test case 1 and test case 2 return False. </p>

<pre><code>import math

test_cases = [1, 9, -3]  
test_case_answers = [1, 3, 0]

def custom_sqrt(num):  
    for i in range(len(test_cases)):  
        if test_cases[i] &gt;= 0:  
            return math.sqrt(test_cases[i])  
        else:  
            return 0

for i in range(len(test_cases)):  
    if custom_sqrt(test_cases[i]) != test_case_answers[i]:  
        print "Test Case #", i, "failed!"


custom_sqrt(test_cases)
</code></pre>
