Conversion code not working properly

weasel healthed at hotmail.com
Sun Feb 22 15:34:08 EST 2004


Well, I know that the range command is the problem, because it just
keeps adding 1 which throws off the decimal entries. So, in removing
range, I need to take the beginning temp, and add up to the ending
temp.

The conversion seems to be working fine, even by using "float" for the
input.

On Sun, 22 Feb 2004 21:15:30 +0100, Andrei <fake at fake.net> wrote:

>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).




More information about the Python-list mailing list