mercredi 1 mai 2019

How to input a list of quantities into one function and print the output to console

I have a list of quantities (100,500,1000]. I want to generate random numbers between 0 and 10, 100 times, 500 times, 1000 times. I want to do this in one call and print the output to the console.

def random_array(n): #define function to generate the random array
    array_a = []
    for i in range(0, n, 1):
        array_a.append(randint(0, 10))
    return array_a




Aucun commentaire:

Enregistrer un commentaire