[Tutor] Temerature conversion??
andy surany
mongo57a@comcast.net
Mon Dec 2 22:48:01 2002
This is a multi-part message in MIME format.
--Boundary_(ID_yFOo7ohLAg4o1c4BzqKUeg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT
Hi Chuck.
The reason you get 95 is that you are performing an "integer" division, i.e. 37/5=7, and 7*9+32=95. Try:
37.0/5*9+32 = 98.6
HTH.
Regards,
Andy
-----Original Message-----
From: Chuck Baker <ChuckBaker@pokynet.com>
To: tutor@python.org <tutor@python.org>
Date: Monday, December 02, 2002 8:41 PM
Subject: [Tutor] Temerature conversion??
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello everyone.
I am new to the list and have just started playing with Python. I
have programed in BASIC before.
I was going through and playing with it and I started out making a
temperature conversion program.
Converting fahrenheit to celsius I had no problem
(98.6-32)/9*5 =37
That worked fine. But when I tried to reverse it,
37/5*9+32
It came out to = 95 not 98.6
and I can't figure out why??
- --
Chuck Baker
ICQ# 1816811
ChuckBaker@Pokynet.com
ChuckBaker1@icqmail.com
Yahoo ID: ChuckBaker11@Yahoo.com
http://Chuck_Baker.Tripod.com
Fax: 801-740-7293
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0 (Build 349) Beta
Comment: Check out my website at http://Chuck_Baker.tripod.com
iQA/AwUBPeqg8HgliK6chUrEEQIRHACdEu6D2A6oCMJiihEDt2czst9UG0IAn1tV
rdBJl7piIGnYpApGOK2YmvNg
=D154
-----END PGP SIGNATURE-----
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
--Boundary_(ID_yFOo7ohLAg4o1c4BzqKUeg)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 5.50.4522.1800" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi Chuck.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The reason you get 95 is that you are performing an "integer"
division, i.e. 37/5=7, and 7*9+32=95. Try:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>37.0/5*9+32 = 98.6</FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>HTH.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Regards,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Andy</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=Arial size=2><B>-----Original Message-----</B><BR><B>From:
</B>Chuck Baker <<A
href="mailto:ChuckBaker@pokynet.com">ChuckBaker@pokynet.com</A>><BR><B>To:
</B><A href="mailto:tutor@python.org">tutor@python.org</A> <<A
href="mailto:tutor@python.org">tutor@python.org</A>><BR><B>Date:
</B>Monday, December 02, 2002 8:41 PM<BR><B>Subject: </B>[Tutor] Temerature
conversion??<BR><BR></DIV></FONT>-----BEGIN PGP SIGNED MESSAGE----- <BR>Hash:
SHA1
<P>Hello everyone.
<P>I am new to the list and have just started playing with Python. I <BR>have
programed in BASIC before.
<P>I was going through and playing with it and I started out making a
<BR>temperature conversion program.
<P>Converting fahrenheit to celsius I had no problem <BR>(98.6-32)/9*5 =37
<P>That worked fine. But when I tried to reverse it, <BR>37/5*9+32 <BR>It came
out to = 95 not 98.6
<P>and I can't figure out why??
<P>- -- <BR>Chuck Baker <BR>ICQ# 1816811 <BR>ChuckBaker@Pokynet.com
<BR>ChuckBaker1@icqmail.com <BR>Yahoo ID: ChuckBaker11@Yahoo.com <BR><A
href="http://Chuck_Baker.Tripod.com">http://Chuck_Baker.Tripod.com</A>
<BR>Fax: 801-740-7293 <BR>
<P>-----BEGIN PGP SIGNATURE----- <BR>Version: PGP 8.0 (Build 349) Beta
<BR>Comment: Check out my website at <A
href="http://Chuck_Baker.tripod.com">http://Chuck_Baker.tripod.com</A>
<P>iQA/AwUBPeqg8HgliK6chUrEEQIRHACdEu6D2A6oCMJiihEDt2czst9UG0IAn1tV
<BR>rdBJl7piIGnYpApGOK2YmvNg <BR>=D154 <BR>-----END PGP SIGNATURE-----
<BR> _______________________________________________ Tutor maillist -
Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor</P></BLOCKQUOTE></BODY></HTML>
--Boundary_(ID_yFOo7ohLAg4o1c4BzqKUeg)--