float / rounding question
tjreedy at udel.edu
Mon Feb 25 21:14:38 CET 2008
<helen.m.flynn at gmail.com> wrote in message
news:d4d9e9d6-b0e0-4063-a5b2-456bcea5a6ce at z17g2000hsg.googlegroups.com...
| Hi I'm very much a beginner with Python.
| I want to write a function to convert celcius to fahrenheit like this
| def celciusToFahrenheit(tc):
| tf = (9/5)*tc+32
| return tf
Unless you are importing 'integer division' or using 3.0, that should be
| I want the answer correct to one decimal place, so
| celciusToFahrenheit(12) would return 53.6.
As written, running above on 2.x returns 44.
More information about the Python-list