Basic Python functions. beginner
<p>This is all I have so far : </p>

<pre><code>def anagram(str1, str2):

    print("String 1 : %s" %str1) 
    print("String 2 : %s" %str2)
    s1 = sorted(str1.lower()) 
    s2 = sorted(str2.lower())

    if s1 == s2:
       print("This is an anagram") 
       return True

def test_anagram():

    print( "\n** Testing example anagrams **\n")

    tests = [["dog", "cat"]]

    num_anagrams = 0

    for test in tests:
     answer = anagram(test[0] , test[1])
     print("For inputs " + test[0] + " and " + test[1] + " answer is: ", answer, end ="")
     if answer == test[0]:
        print("This test is correct")
         num_anagrams += 1
</code></pre>

<p>I don't think this is close to right. I want it to compare the actual result to what the function previous gives out as a result, then output whether the result was the same, being 'correct' or not 'incorrect' then output how many tests worked correctly against the function. I cant get my head around the if statement</p>

<p>Thanks for the help!   </p>

<p>You're treating <code>str1</code> and <code>str2</code> like functions, when you're really just passing <code>str</code> objects, which, according to your error, are not callable (i.e. don't work as functions).</p>

<p>Are you trying to accept input? If so, use <code>str1 = input("String 1 : ")</code> and so on.</p>

<p>Otherwise, if you're trying to format output, use this:</p>

<pre><code>print("String 1 : " % str1)
</code></pre>

python function basic