title: Determining whether a number is prime or not
body: <p>I know it's been discussed many times; I've read it, but somehow I can't get it.
  I want to write a program that determines if the entered number is prime or not.</p>
  
  <p>One of the implementations I found somewhere on the Internet:</p>
  
  <pre><code>from math import *
  
  def main():
      n = abs(input("Enter a number: "))
      i = 2
      msg = 'is a prime number.'
      while i &lt;= sqrt(n):
          if n % i == 0:
              msg = 'is not a prime number.'
          i = i + 1
      print n, msg
  
  
  main()
  </code></pre>
  
  <p>A couple of questions here:</p>
  
  <ul>
  <li>In the above, what is <code>i</code>, and why does it have a starting value of <code>2</code>?</li>
  <li>What does <code>i = i + 1</code> do in this program?</li>
  <li>How does the interpreter know when to print <code>'is a prime number.'</code> even though it is out of the body loop? </li>
  </ul>