Small newbie question

Byte eoinrogers at gmail.com
Sun Feb 12 14:55:04 EST 2006


How would I do this: Write a program that simply outputs a ramdom (in
this case) name of (for this example) a Linux distibution. Heres the
code ive tryed:

from random import uniform
from time import sleep

x = 2
while x < 5:
    x = uniform(1, 5)
    if x >= 1 <= 1.999: print 'SuSE'
    elif x >= 2 <= 2.999: print 'Ubuntu'
    elif x >= 3 <= 3.999: print 'Mandriva'
    elif x >= 4 <= 4.999: print 'Fedora'
    sleep(2)

It dosnt work: only keep printing SuSE. Please help,

Thanks in advance,
 -- /usr/bin/byte




More information about the Python-list mailing list