dimanche 28 octobre 2018

Call a list of functions with random parameters

How can I call a set of functions using random arguments.

import random

def sum_3 (a):
    return (sum(a) + 3)
def sum_2 (b):
    return (sum(b) + 2)

# Call the functions 
functions = [sum_3, sum_2]
# Using random arguments
random.sample(range(1, 100000), 5)




Aucun commentaire:

Enregistrer un commentaire