samedi 23 septembre 2017

How to count number of values in the randomly generated list?

I have created a random list by below command:

import random a=[random.randrange(0,100) for i in xrange(50)] print a

Now, what could be the command for counting the number of values that are between 0 and 9, 10 and 19, 20 and 29, and so on.

I can print them as below:

import random a=[random.randrange(0,100) for i in xrange(50)] for b in a: if 10

But, I don't know how to write a command to count the number of the values after printing b. Thanks for your comments.




Aucun commentaire:

Enregistrer un commentaire