title: Python 'builtin_function_or_method' object is not iterable error
body: <p>i created this program which will replace a sentence with the words in its position and saves them as a separate file. However when i run it i get this error:
      Traceback (most recent call last):
        File , line 12, in 
          Positions = list2.index(word)</p>
  
  <p>here is the code:</p>
  
  <pre><code>UserSentence = input("enter sentence:").lower()
  words = UserSentence
  words = words.split()
  number = 0
  list1 = []
  list2 = " "
  
  for Position in words:
      if Position not in list1:
          list1.append(Position)
  for word in words:
          Positions = list2.index(word)
          list2+=str(Positions+int("1"))
          list2 +=("")
  list1str += ";".join(list1)
  
  file = open ("myfile.txt","w")
  file.write(sentence)
  file.write(list1str)
  file.write(list2)
  file = open ("myfile.txt", "r")
  print (file.read())
  file.close()
  </code></pre>
  
  <p>could someone explain me what mistake i made in my code?</p>