title: 'list' object has no attribute 'lower' in Python
body: <p>function anagrams(s1, s2) is a Boolean valued function, which returns true just in case the string s1 contains the same letters as string s2 but in a different order. The function should be case insensitive --- in other words it should return the same value if any letters in either s1 or s2 are changed from upper to lower case or from lower to upper case. You may assume that the input strings contain only letters.
  <a href="https://i.stack.imgur.com/f59bn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f59bn.png" alt="enter image description here"></a></p>
  
  <p>The function find_all_anagrams(string) takes a string as input and returns a list of all words in the file english_words.txt that are anagrams of the input string.
  the function should return a list [word1, ..., wordN] such that each word in this list is a word in the dictionary file such that the value function anagrams(string, word) are True</p>
  
  <pre><code>def anagrams( string1, string2 ):
      str_1 = string1.lower()
      str_2 = string2.lower()
      if str_1 == str_2:
          return False
      else:
          list_1 = list( str_1 )
          list_1.sort()
          list_2 = list( str_2 )
          list_2.sort()
          return list_1 == list_2
  
  def find_all_anagrams( string ):
      with open("english_words.txt") as f:
          word_list = []
          for line in f.readlines():
              word_list.append(line.strip())
          list1 = [i.split() for i in word_list]
      for j in list1:
          if anagrams( string, j ) == True:
              return list1
          else:
              return []
  </code></pre>
  
  <p>ERROR kept saying this: AttributeError: 'list' object has no attribute 'lower'</p>
  
  <p>for example,word_list contains:
  ['pyruvates', 'python', 'pythoness', 'pythonesses', 'pythonic', 'pythons', 'pyuria', 'pyurias', 'pyx', 'pyxes']</p>
  
  <p>Expected output below
  <a href="https://i.stack.imgur.com/ZzViG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZzViG.png" alt="enter image description here"></a>
  Part of the txt file shown on the right:
  <a href="https://i.stack.imgur.com/mMzyB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mMzyB.png" alt="enter image description here"></a></p>
  
  <p>Update:
  I think I just solved it,here are my codes:</p>
  
  <pre><code>def find_all_anagrams( string ):
      list1 = []
      with open("english_words.txt") as f:
          word_list = []
          for line in f.readlines():
              word_list.append(line.strip())
      for i in word_list:
              if anagrams( string, i ):
                  list1.append(i)
      return list1
  </code></pre>