title: NameError: name 'output' is not defined
body: <p>I've just started learning python and was writing a (seemingly) simple program but encountered the "name not defined" error.</p>
  
  <p>This is my code: </p>
  
  <pre><code>if iDisL == cDisL or iDisL == cDisR:
      output = iDisL
  
  if iDisR == cDisL or iDisR == cDisR:
      output = iDisR
  
  oFile = open("manout.txt", "w")
  oFile.write(output)
  </code></pre>
  
  <p>The strange thing is this worked the first time when running, but did not when I plugged in a new set of numbers into my input file. I am running python 3.</p>