title: Python: Test whether a number is within 100 of 1000 or 2000
body: <p>After reading the problem I had no clue to solve it, so I read the below solution and still dont have any clue what it means. Can anyone walk me through the objective of the problem and how the below code solves the problem?</p>
  
  <p>Below is the sample code to solve the problem:</p>
  
  <pre><code>def near_thousand(n):
    return ((abs(1000 - n) &lt;= 100) or (abs(2000 - n) &lt;= 100))
  print(near_thousand(1000))
  print(near_thousand(900))
  print(near_thousand(800))   
  print(near_thousand(2200))
  </code></pre>