title: Returned values not used
body: <pre><code>&gt;&gt;&gt; def square(x):
          print('LINE A:', x)
          x = x*x
          print("LINE B:", x)
          return x
  
  
  &gt;&gt;&gt; if __name__ == '__main__':
          x = 5
          print("LINE C:", x)
          square(x)
          print("LINE D:", x)
          square(x + 1)
          print("LINE E:", x)
  </code></pre>
  
  <p>Produces:</p>
  
  <pre><code>LINE C: 5
  LINE A: 5
  LINE B: 25
  25
  LINE D: 5
  LINE A: 6
  LINE B: 36 
  36
  LINE E: 5
  </code></pre>
  
  <p>In my understanding, it should return the following:</p>
  
  <pre><code>LINE C: 5
  LINE A: 5
  LINE B: 25
  25
  LINE D: 25
  LINE A: 25
  LINE B: 676 
  676
  LINE E: 676
  </code></pre>
  
  <p>In the first(top) function, I assign the parameter x with x*x. Therefeore, in the if <strong>name</strong> == '<strong>main</strong>': function, print("LINE D:", x) is suppose to print the x that is returned by the square(x) that is called previously. But for some reason this is not the case, what did I do wrong? Or is it my understanding that is incorrect?</p>
  
  <p>P.S. I am not exactly seeking to correct the function. I am simply finding an explanation to why it works this way.</p>