title: changing global variables within a function in python
body: <p>I'm new to python. </p>
  
  <p>I don't quite understand how I need to set variables and change them within a function to be used late. My script needs to get an x and y value from a function which are determined by the size of the chart the function creates. These variable need to be passed to a print command later in the script to output html. So let's say I have global variables:</p>
  
  <pre><code>    originx_pct = 0.125
      originy_pct = 0.11
  </code></pre>
  
  <p>But these will need to change when the funtion is run...</p>
  
  <pre><code>    def makeplot(temp, entropy,preq):
          originx_pct = origin.get_points()[0][0]
          originy_pct = origin.get_points()[0][1]
  </code></pre>
  
  <p>Then printed within the javascript of the html page that is written later...</p>
  
  <pre><code>    print('var originx_pct = {};'.format(originx_pct))
      print('var originy_pct = {};'.format(originy_pct))
  </code></pre>
  
  <p>The 2 variables don't change and I just don't understand what I need to do to update them and be able to print them (outside the function). I'm assuming that the function does not know about the variables so it can't change them. If I feed the function the 2 variables as arguments, how do i get the values back out for the print part of the script? </p>