title: Nested for loop to go through every combination in text file
body: <p>Below is the code I have:</p>
  
  <pre><code>with open('test.txt') as f:
      for i in f:
  
          for j in f:
  
              pw_n= i+j
              print(pw_n)
  </code></pre>
  
  <p>Sample data from test.txt is:</p>
  
  <pre><code>USA
  Canada
  Mexico
  China
  Russia
  </code></pre>
  
  <p>Output Currently:</p>
  
  <pre><code>USA
  CANADA
  
  USA
  MEXICO
  
  USA
  China
  
  USA
  Russia
  </code></pre>
  
  <p>The above is great but I would like it to go through all iterations. So, after it finishes USA, I would like it to go to Canada then Mexico, etc... Ex.:</p>
  
  <pre><code>Canada
  USA
  
  Canada
  Canada
  
  Canada
  Mexico
  ..........
  </code></pre>
  
  <p>Any help regarding this would be great. I've tried to increment 'i' by 1 but that wasn't working.</p>
  
  <p>Thanks! </p>