title: sending variables between functions
body: <p>Probably a duplicate but after 15 min I couldn't find an answer to my question, probably my poor coding terminology.</p>
  
  <p>what is it about my logic that I'm incorrectly passing my arguments?  Please refrain from chastising my choice code itself, I'm not very good at this and I know it.</p>
  
  <p>The program is supposed to:</p>
  
  <ul>
  <li>a)create a set of all the unique words in file1 and print them</li>
  <li>b)create a set of all the unique words in file2 and print them</li>
  <li>c)print all of the words that are contained in both files</li>
  <li>d)print all    of the unique words that are contained in either file</li>
  <li>e)print all of    the words that are contained in file1 but not file2</li>
  <li>f)print all of    the words that are contained in file2 but not file1</li>
  <li>g)print all of    the words that are contained in either file but not
  both</li>
  </ul>
  
  <p>Items (a) and (b) should be produced by the function that creates the sets; there should be a separate function for each of the others.
  btw is case it somehow helps file 1 is:</p>
  
  <ul>
  <li>"Now is the time for all good men to come to the aid of their party."</li>
  </ul>
  
  <p>file 2 is:</p>
  
  <ul>
  <li><p>"It is time to go to the party."</p>
  
  <pre><code> def main():
      file1()#obtain file1 uniquness
      file2()#obtain file2 uniqueness
      print("C) Words that appear in both files: "+str(set_1&amp;set_2)+'\n')#addd them
      print("D) Unique words that appear in either file: "+str(set_1|set_2)+'\n')
      print("E) Words that appear in file1 but not file2: "+str(set_1-set_2)+'\n')    #subtract words found in 2 from 1
      print("F) Words that appear in file2 but not file1: "+str(set_2-set_1)+'\n')
      print("G) Words that appear in either file but not both: "+str(set_1^set_2)+'\n')
  
  
  def file1():
      file_1=open('file1.txt', 'r')
      file_1=file_1.readline()
      setlist_1=file_1.split()#convert file 1
      set_1=set()
      for word in setlist_1:
          word=word.lower()
          word=word.rstrip("\n")#process uniqueness
          set_1.add(word)
      print("A) Unique words in file1: "+str(set_1)+'\n')#print A
      return set_1
  
  
  def file2():
      file_2=open('file2.txt','r')
      file_2=file_2.readline()#convert file 2
      setlist_2=file_2.split()
      set_2=set()
      for words in setlist_2:
          words=words.lower()#process uniqueness
          words=words.rstrip("\n")
          set_2.add(words)
      print("B) Unique words in file2: "+str(set_2)+'\n')#print B
      return set_2
  
  main()
  </code></pre></li>
  </ul>