count objects in a list and random numb gen

Bart Nessux bart_nessux at hotmail.com
Thu Jan 8 18:17:17 EST 2004


New to Python... trying to figure out how to count the objects in a list 
and then map the count to the objects or convert the list to a dict... I 
think the latter would be better as I need a number associated with each 
entry. Any pointers?

Also, does this bit of code look to be truely random?

def random_number_gen():
    winner = []	
    winner.append(random.sample(xrange(100000), 1))	
    print winner	

TIA, Bart






More information about the Python-list mailing list