F
F
Fedor Maslennikov2021-10-08 05:26:19
Python
Fedor Maslennikov, 2021-10-08 05:26:19

How to implement a function that performs random functions?

There is a list of functions that I wrote in a file separate from the main program (all of them are quite simple and do not require much time / memory). How can I write a function that executes a random one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yanis07, 2021-10-08
@Lordliness

my_list = [func_test_1, func_test_2, func_test_3]
random.choice(my_list)()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question