I have a code which has functions, which should be called randomly. However, when I am running the code:
def print1():
print(1)
def print2():
print(2)
def print3():
print(3)
l=(print1(), print2(), print3())
x=random.choice(l)
x()
it doesn't work properly. It is outputting everything (1,2,3) and gives an error:
''NoneType' object is not callable'
How to fix that?
Aucun commentaire:
Enregistrer un commentaire