title: How to pick the first number after decimal point in Python 3.5?
body: <p>I'm learning Python currently (love it so far) and have made a little Fahrenheit/Celsius converter.</p>
  <p>This is the output upon running it:</p>
  <blockquote>
  <p>Please enter the degrees in Fahrenheit or Celsius to convert: 32</p>
  <p>32.0 degrees Celsius is 89.6 degrees Fahrenheit.</p>
  <p>32.0 degrees Fahrenheit is 0.0 degrees Celsius.</p>
  <p>Do you want to calculate again? (y/n):</p>
  </blockquote>
  <p>Which is how I want it, except if the trailing number after the decimal is a 0 (a whole number), I'd like to drop the .0 entirely (i.e. 5.0 to 5). I'm guessing I'd want an if statement to test if it's equal to zero but how would I go about picking that value?</p>
  <p>Full code:</p>
  <pre><code>answer = &quot;ERROR&quot;
  
  def calcfc():
  &quot;&quot;&quot; Calculates F to C and C to F, prints out,
      and asks if user wants to run again &quot;&quot;&quot;
      try:
          degrees = float(input(&quot;\nPlease enter the degrees in Fahrenheit or Celsius to convert: &quot;))
      except Exception:
          input(&quot;\nEnter a valid number next time. Hit enter to terminate.&quot;)
          exit()
  
      ftoc = (degrees - 32) * 5 / 9
      ctof = (degrees * 9) / 5 + 32
  
      print(&quot;\n{} degrees Celsius is {:.1f} degrees Fahrenheit.&quot;.format(degrees, ctof))
      print(&quot;{} degrees Fahrenheit is {:.1f} degrees Celsius.&quot;.format(degrees, ftoc))
      global answer
      answer = input(&quot;\n\nDo you want to calculate again? (y/n): &quot;)
  
  calcfc()
  
  # run again?
  while answer != &quot;y&quot; and answer != &quot;n&quot;:
      answer = input(&quot;\nPlease enter y for yes or n for no: &quot;)
  while answer == &quot;y&quot;:
      calcfc()
  if answer == &quot;n&quot;:
      exit()
  </code></pre>