Help with python functions?

Denis McMahon denismfmcmahon at gmail.com
Tue Sep 24 10:51:31 EDT 2013


On Mon, 23 Sep 2013 19:40:47 -0700, kjakupak wrote:

> Not sure if we've gotten that far in class, considering I don't know how
> to go about doing that.

Which bit aren't you sure about?

(a) adding a "same unit" conversion to the units conversion program? 
(Actually, this bit isn't needed after all, you can avoid it with a test 
in comp.)

(b) calling temp from comp to establish a common unit?

(c) comparing the returned value of the call to temp with the other temp 
in comp

Question, given the original "temp" function as previously described by 
yourself, what does the following function "f" which takes the same params 
as "comp" do:

def f( t1, u1, t2, u2 ):
    if u1 == u2:
        return t2
    else:
        return temp( t2, u2, u1 )

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list