title: How to check a list for greater or less than var integers
body: <pre><code>var=42
  
  l = [1,2,3,7,3,5,21,8,44,16,13]
  
  if l.index(5) &lt; l.index(var-20):
      print ("True")  
  
  else:
      print ("False")
  </code></pre>
  
  <p>I want to pick a value (var) and test to see which comes first from the list, either var+ (for example 20), or var- (again could be 20).</p>
  
  <p>The problem I am having with the above code is that if a value doesn't exist in the list, then it gives me an error telling me so.</p>