title: Prime number calculator functions, why is one correct and the other incorrect?
body: <p>I've seen some similar codes here on stack overflow but none had my same question.
  basically, my question is why when I tried to check the inequality (!=) in the for loop it didn't work. But when I tried using the equality (==) it worked fine?</p>
  
  <p>so this code returns True always:</p>
  
  <pre><code>def is_prime(x):
    if x == 2:
      return True
    else:
      for i in range(2, x):
          if x &gt; 2:
              if x % i != 0:
                  return True
      return False
  </code></pre>
  
  <p>while this code is works fine:</p>
  
  <pre><code>def is_prime(x):
    if x &lt; 2:
      return False
    if x == 2:
      return True
    else:
      for i in range(2, x):
          if x &gt; 2:
              if x % i == 0:
                  return False
      return True
  </code></pre>