title: NameError: name 'x' is not defined in for loop
body: <p>New to Python, trying to figure out how to use it.</p>
  
  <p>Using the below piece of code gives me an error:</p>
  
  <blockquote>
    <p>NameError: name 'x' is not defined?</p>
  </blockquote>
  
  <p>Is it related to using <code>and</code> in the <code>for</code> loop? How can I fix it?</p>
  
  <pre><code>lis = list(range(101))
  lis1 = lis[::-1]
  tot = 0
  for i in range(101) and x in lis[:-1]:
      tot = i + x
      print(tot)
  </code></pre>