+ 3
when we call this function multiple time it make mistakes,
i want to select groups where no 2 elements of the group talk the same language. the problem is with the condition: while res[i][1] == res[i-1][1] can you help me? https://code.sololearn.com/ccQz7O3IvjzS/?ref=app
2 Answers
+ 4
def group (x, y):
res = random.sample(seq, y)
while len(set([u[1] for u in res])) < y:
res = random.sample(seq, y)
return res
+ 3
it works, thank you Anna