title: Anagram test for two strings in python
body: <p>This is the question:</p>
  
  <blockquote>
    <p>Write a function named test_for_anagrams that receives two strings as
    parameters, both of which consist of alphabetic characters and returns
    True if the two strings are anagrams, False otherwise. Two strings are
    anagrams if one string can be constructed by rearranging the
    characters in the other string using all the characters in the
    original string exactly once. For example, the strings "Orchestra" and
    "Carthorse" are anagrams because each one can be constructed by
    rearranging the characters in the other one using all the characters
    in one of them exactly once. Note that capitalization does not matter
    here i.e. a lower case character can be considered the same as an
    upper case character.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>def test_for_anagrams (str_1, str_2):
      str_1 = str_1.lower()
      str_2 = str_2.lower()
      print(len(str_1), len(str_2))
      count = 0
      if (len(str_1) != len(str_2)):
          return (False)
      else:
          for i in range(0, len(str_1)):
              for j in range(0, len(str_2)):
                  if(str_1[i] == str_2[j]):
                      count += 1
          if (count == len(str_1)):
              return (True)
          else:
              return (False)
  
  
  #Main Program
  str_1 = input("Enter a string 1: ")
  str_2 = input("Enter a string 2: ")
  result = test_for_anagrams (str_1, str_2)
  print (result)
  </code></pre>
  
  <p>The problem here is when I enter strings as <code>Orchestra</code> and <code>Carthorse</code>, it gives me result as <code>False</code>. Same for the strings <code>The eyes</code> and <code>They see</code>. Any help would be appreciated.</p>