I have defined four functions. These functions return the same varables but have different parameters.
Here is a simple example:
def func1(studentID, homework1, T1):
if len(homework1) > T1:
score[studentID] = 1
else:
score[studentID] = 0
return score
def func2(studentID, homework2, T2, attendance):
if len(homework2) > T2 and attendance == 1:
score[studentID] = 1
else:
score[studentID] = 0
return score
Now I need to execute these functions in a random order, i.e., sometimes func1 firstly and func2 secondly, but sometimes otherwise. I only know how to do that without parameters and returns as following:
import random
functions = [func1, func2]
random.shuffle(functions)
for i in functions:
i()
But have no idea how to do it with parameters and returns.
Aucun commentaire:
Enregistrer un commentaire