jeudi 7 janvier 2021

Python: Randomly execute python functions with not random inner parameters

I am creating a function that executes other functions randomly, but the difference between all other examples I have seen in Stack Overflow is that in this case, the parameters must be specific for every function.

For example: func_a() can only be executed with parameter a

import random    

def account(self, first_name, last_name, ID):
    random.choice([
                self.function_first_name(first_name),
                self.function_last_name(last_name),
                self.function_user_name(user_name)
            ])

In this case I am getting the execution in the same order all the time,

How can I keep it simple and execute randomly




Aucun commentaire:

Enregistrer un commentaire