Small newbie question

Paul Rubin http
Sun Feb 12 15:27:34 EST 2006


> while x < 5:
>     x = uniform(1, 5)
>     if x >= 1 <= 1.999: print 'SuSE'
> ...
> It dosnt work: only keep printing SuSE. Please help,

Try this:

     x = 27.6
     if x >= 1 <= 1.999: print 'SuSE'

It prints 'SuSE' because the test is written incorrectly.  You want:

    if 1 <= x <= 1.999: print 'SuSE'



More information about the Python-list mailing list