# [Tutor] my first program

Emile van Sebille Emile van Sebille" <emile@fenx.com
Tue, 15 Feb 2000 06:32:46 -0800

>>> 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@fenx.com
-------------------

----- Original Message -----
From: Caughell family <caughell@netrover.com>
To: <tutor@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@python.org
> http://www.python.org/mailman/listinfo/tutor
>