[Tutor] Temperature Scales

Corey Richardson kb1pkl at aim.com
Mon Nov 29 03:23:59 CET 2010



On 11/28/2010 8:33 PM, Andre Jeyarajan wrote:
>
> Write two functions that will convert temperatures back and forth from 
> the Celsius and Fahrenheit temperature scales (using raw_input)
>
>
> def C_F(x):
>
>     y = (x-32)*(5.0/9)
>
> print y
>
>
> def F_C(x):
>
>     y = (x*9.0/5)+32
>
> print y
>
>
> I have created the two functions but I don’t know what to do from here.
>
>
> Can you help?
>
>
> Thanks
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
I get the curious feeling this is homework.  You would need to do one of 
two things:
Pass the output of raw_input as an argument or rewrite your functions so 
that instead of taking the temperature as a parameter, it asks in the 
body of the function for a temperature. In either case, you will run 
into a little TypeError, easily fixed however.
HTH,
~Corey Richardson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101128/ed5e2ecc/attachment.html>


More information about the Tutor mailing list