[Tutor] my first program
Emile van Sebille
emile at fenx.com
Tue Feb 15 09:11:43 EST 2000
More information about the Python-list mailing list
Tue Feb 15 09:11:43 EST 2000
- Previous message (by thread): erasing and writing test on console.
- Next message (by thread): Python on the Palm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> a = 1 >>> b = 3.0 >>> print a/b 0.333333333333 >>> b = 3 >>> print a/float(b) 0.333333333333 >>> print a/b 0 >>> print round(a/float(b),2) 0.33 >>> HTH Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Caughell family <caughell at netrover.com> To: <tutor at python.org> Sent: Tuesday, February 15, 2000 3:55 AM Subject: [Tutor] my first program > This is a little program I designed to test experimental odds against > theoretical odds. > > There is a problem. > > After much deliberation, I simplified the formula that I was using to make > the differentiation percentage with, which ended up doing the exact same > thing, just simpler. However, the program still wouldn't work. > > The problem is that I don't know how to make a division become a real > number, especially when involving variables. (I know that I can do 2/7.0 > instead of 2/7 to make it a real result) > > Thanks a lot! > > Also, I've got one question involving real numbers in this python.. > is there any way that I can limit the number to a certain ammount of decimal > places? will it be rounded or truncated, or automatically rounded up? > > Thanks very much!!! > > > _______________________________________________ > Tutor maillist - Tutor at python.org > http://www.python.org/mailman/listinfo/tutor >
- Previous message (by thread): erasing and writing test on console.
- Next message (by thread): Python on the Palm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list