Help with python functions?

kjakupak at gmail.com kjakupak at gmail.com
Mon Sep 23 08:57:34 EDT 2013


1.a. Write a function temp(T, from_unit, to_unit) where from_unit and to_unit are temperature units, either 'F' (or 'f') for fahrenheit, or 'C' (or 'c') for celsius, or 'K' (or 'k') for kelvin; and T is a temperature number for the unit from_unit. The function should return the temperature number in the unit to to_unit; no unit is returned. [input(...) and print(...) are not allowed]

1.b. Write a function comp(T1, u1, T2, u2) where u1, u2 are temperature units as in 1.a., and T1, T2 are temperature numbers for these units. The function should return -1 if T1 in u1 is a lower temperature than T2 in u2; it should return 0 is the two express equal temperatures; and it should return 1 otherwise. 

2. Write a function P(p_0, t, i) where t is a time in years *integer), is is a yearly interest (as a traditional percentage), and p_0 is the initial principal (at time 0). The function should return the principal at time t. Principals and interests are float numbers.

Can anyone help me with any of these please? Much appreciated. I honestly don't even know how to start them



More information about the Python-list mailing list