Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54631

Help with python functions?

Newsgroups comp.lang.python
Date 2013-09-23 05:57 -0700
Message-ID <e484b709-1287-4e6a-bc43-05f02a608579@googlegroups.com> (permalink)
Subject Help with python functions?
From kjakupak@gmail.com

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Help with python functions? kjakupak@gmail.com - 2013-09-23 05:57 -0700
  Re: Help with python functions? Roy Smith <roy@panix.com> - 2013-09-23 09:11 -0400
  Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 13:56 +0000
    Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 15:32 -0700
      Re: Help with python functions? Terry Reedy <tjreedy@udel.edu> - 2013-09-23 18:48 -0400
      Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:08 +0000
      Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:17 +0000
      Re: Help with python functions? giacomo boffi <pecore@pascolo.net> - 2013-09-24 18:53 +0200
        Re: Help with python functions? MRAB <python@mrabarnett.plus.com> - 2013-09-24 18:18 +0100
    Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 15:55 -0700
      Re: Help with python functions? Dave Angel <davea@davea.name> - 2013-09-24 00:07 +0000
        Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 18:23 -0700
          Re: Help with python functions? Dave Angel <davea@davea.name> - 2013-09-24 03:52 +0000
      Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 02:12 +0000
        Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 19:40 -0700
          Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 14:51 +0000
            Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 19:42 +0000
              Re: Help with python functions? kjakupak@gmail.com - 2013-10-01 10:53 -0700
                Re: Help with python functions? random832@fastmail.us - 2013-10-01 15:02 -0400
                Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-01 21:45 +0000
                Re: Help with python functions? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-01 19:19 -0400
      Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:15 +0000
        Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 15:02 +0000

csiph-web