Help with python functions?
Denis McMahon
denismfmcmahon at gmail.com
Mon Sep 23 22:12:05 EDT 2013
On Mon, 23 Sep 2013 15:55:53 -0700, kjakupak wrote:
> As for the next one, so far I've gotten:
> def comp(T1, u1, T2, u2):
> if u1 > u2:
> return -1
> elif u2 > u1:
> return 1
> else:
> return 0
If the first function you wrote allows you to convert temps in different
scales to a common scale, then in the second function, you can call the
first function to convert both temps to a common scale, and compare them.
Adding "same scale" conversions in the first function might help. In a
same scale conversion, the input and output units are the same, and the
output value is the input value.
Then to compare T1 in u1 and T2 in u2, convert them both to a common
scale (which might be u1 or u2 or some other scale) using your temp
function, and then compare the resulting values.
--
Denis McMahon, denismfmcmahon at gmail.com
More information about the Python-list
mailing list