title: Python - Accessing items inside a list from text file
body: <p>I am trying to apply validation for the items in a list. I have managed to open it but am struggling trying to compare if the two words are anagrams. </p>
  
  <p>This is my result in the terminal.</p>
  
  <pre><code>anagram:  ['word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff']
  
  Anagram
  </code></pre>
  
  <p>In this sample, it is clear I am doing it wrong with the two identical variables A, B but am not sure what to do.</p>
  
  <pre><code>word1 = open('a.txt', 'r').read().split()
  word2 = open('a.txt', 'r').read().split()
  count = {}
  validation = True
  if len(a) == len(b):
      for i in range(len(a)):
          if a[i] in count:
              count[a[i]] += 1
          else:
              count[a[i]] = 1  
          if b[i] in count:
              count[b[i]] += 1
          else:
              count[b[i]] = 1     
      for i in count:
          if count[i] % 2 == 0:
              validation = "Anagram"
          else:
              validation = "Not Anagram"
              break
  else:
      validation = "Not Anagram"            
  print(validation)
  </code></pre>
  
  <p>What the hell am I doing?</p>
  
  <p>I want to achieve this in the terminal.</p>
  
  <pre><code>anagram:  ['word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff', 'word,word', 'stiff,schtiff']
  
  anagram, not anagram, anagram, not anagram, anagram, not anagram, anagram, not anagram
  </code></pre>