I'm trying to create a function that I can call and it selects a random function from a list of functions and calls the selected function into action. Is that even possible? Here what I have tried. Which results in nothing happening.
import random
def ran1():
print("test1")
def ran2():
print("test2")
def ran3():
print("test3")
def ran4():
print("test4")
list_functions = [ran1,ran2,ran3,ran4]
def ran_choice():
random.choice(list_functions)
ran_choice()
Aucun commentaire:
Enregistrer un commentaire