Help with if statement
Ganesan R
rganesan at myrealbox.com
Sun Jan 11 01:07:38 EST 2004
>>>>> "Jikosan" == Jikosan <jikosan83 at yahoo.com> writes:
> I can't get my "if" statement to work indicated below. What happens is no
> matter what the value random is, neg gets incremented by 1.
> for x in range(0,N):
> random = uniform(-1, 1)
> print random
> if random < 1.0: <--- Not working
> neg = neg+1
Since uniform will return numbers in the interval [-1, 1), all instances of
random will be less than 1.0. May be you meant to say random < 0.0?
Ganesan
--
Ganesan R (rganesan at debian dot org) | http://www.debian.org/~rganesan/
1024D/5D8C12EA, fingerprint F361 84F1 8D82 32E7 1832 6798 15E0 02BA 5D8C 12EA
More information about the Python-list
mailing list