Np.random.choice() takes at most 4 positional arguments (9 given)

Hi everyone! I solved it. If anyone else wants to randomise but wants certain 'constraints. This line of code uses NumPy to select elements from the all_ps list based on a condition (In this case, the condition is that the elements of the olevels list are equal to base_lev). The numpy.where function is used to return a tuple of arrays, one for each dimension of the input array, that indicate the indices where the specified condition is true.

The * operator is used to unpack the tuple returned by numpy.where into separate arguments for the itemgetter function. The itemgetter function then returns a callable object that can be used to retrieve the specified elements from the all_ps list.p1.

indices1 = numpy.where(numpy.array(olevels) == base_lev)[0]
numpy.random.shuffle(indices1)
p1 = itemgetter(*indices1)(all_ps)

indices2 = numpy.where(numpy.array(olevels) == base_lev+1)[0]
numpy.random.shuffle(indices2)
p2 = itemgetter(*indices2)(all_ps)

indices3 = numpy.where(numpy.array(olevels) == base_lev+2)[0]
numpy.random.shuffle(indices3)
p3 = itemgetter(*indices3)(all_ps)

indices4 = numpy.where(numpy.array(olevels) == base_lev+3)[0]
numpy.random.shuffle(indices4)
p4 = itemgetter(*indices4)(all_ps)

indices5 = numpy.where(numpy.array(olevels) == base_lev+4)[0]
numpy.random.shuffle(indices5)
p5 = itemgetter(*indices5)(all_ps)

Indices6 = numpy.where(numpy.array(olevels) == base_lev+5)[0]
numpy.random.shuffle(indices6)
p6 = itemgetter(*indices6)(all_ps)

Then use you $your variable in the photo or text (and then in your code put)

if EffortLevel == 6:
your = p6