i trying write function converts number celsius fahrenheit , want able print result 2 decimal places.
my code is:-
def cel2fah(temp): temp = "28.0" return cel2fah
but not getting result. appreciated.
your function never makes calculation. think you're looking this:
def cel2fah(temp): fah = temp * 9.0/5.0 + 32 return fah
you can calculate 28c in fahrenheit calling function this:
cel2fah(28)
if want print 29c in fahrenheit 2 decimal places, here code need run:
def cel2fah(temp): fah = temp * 9.0/5.0 + 32 return fah print "{0:.2f}".format(cel2fah(29.0))