title: Functional Programming: Side Effects
body: <p>Most tutorials/articles/books talk about side effects when presenting functional programming. Take this Python code:</p>
  
  <pre><code>def isPrime(n):
      k = 2
      while k &lt; n:
          if n % k == 0:
              return False
          k += 1
      return True
  </code></pre>
  
  <p>The text says that the above function has local side effects, and I don't understand that. I see that the variable "k" is changing, I don't understand what bad comes out of it.</p>
  
  <p>Can someone please give a clear example of bad side effect, and how it is avoided by functional programming?</p>