Conversion code not working properly

Andrei fake at fake.net
Sun Feb 22 21:15:30 CET 2004


weasel wrote on Sun, 22 Feb 2004 19:45:30 GMT:

> It's not working. I don't think the conversion is the problem. After
> converting, the program shows the original entry you put in

You're right, I saw integer division where you were trying to convert
temperatures and automatically assumed that was the only problem, without
really reading the code. 

> What happened to the other half? I tried using 5.0/9.0, but got the
> same results.

How did you get range() to work on floats without deprecation warnings?
 
> Any more ideas?

Terry Reedy answered a short while ago to why a Celsius range is by
definition shorter than a Fahrenheit range. I'm not quite sure what the
point of the conversion is to be honest, more specifically why a range is
returned. You can't map a celsius temperature in the Celsius range to a
Fahrenheid temperature in the other range and the extreme values are
incorrect due to the integer division and/or the range() used with float
arguments. 42 F should be 5.556 C and your program returns 5.

Btw, there's also a Python list for beginners if you're interested
(python-tutor).

-- 
Yours,

Andrei

=====
Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.



More information about the Python-list mailing list