title: How to print text with the value of a variable
body: <p>I have written a small function to check which of two values is closest to zero. The issue I am having is with the print statement at the end: I want it  to print the text followed by whichever value it determines is the closest.</p>
  <pre><code>def closestcheck(ylow, yhigh, ylist, xlist):
      ynew = (ylow + yhigh) / 2
      #The following 2 prints are purely to check the calculations are correct
      print(ynew)
      print(ylow,yhigh)
      if ynew &gt; 0:
          print('The closest value of theta is' % ylow)
      else:
          print('The closest value of theta is' % yhigh)
  
  closestcheck(y0[-1],y0[-2],y0,x0)
  </code></pre>
  <p>It will print the text but not the number</p>
  <blockquote>
  <p>6.13910823576e-07</p>
  <p>-3.46867223283e-06 4.69649387998e-06</p>
  <p>The closest value of theta is</p>
  </blockquote>
  <p>This specific syntax has worked in other cases but not here, I'm unsure as to why. An explanation of why this isn't working and how to fix it would be much appreciated, thank you!</p>