dimanche 16 octobre 2016

Python: Count number of unique values in random list [duplicate]

This question already has an answer here:

I am stuck on this problem trying to count the number of unique values in a list:

import random
indata = [random.randrange(100) for i in range(20)]

So far this is what I have coded which prints out the 20 random values:

import random
for i in range(20):
    print (random.randrange(100))

How do I continue?




Aucun commentaire:

Enregistrer un commentaire