Hello, I'm new to python and I do not know how to do it:
1) I have a 2x6 matrix generated by random numbers, for example:
matriz = [11, 4, 50, 8, 9, 78]
[10, 33, 44, 57, 80, 90]
What I need to do is: when drawing a value in the range of line 2 [10, 33, 44 ...] I must return its respective value of line 1, for example if the number drawn for 85, I should return the value 9 of line 1. If I left the value 38 in the draw, I should return the value 4 of line 1.
value from 10 to 32 of the second line corresponds to the value 11 of line 1 value from 33 to 43 of the second line corresponds to the value 4 of line 1 and so on, however the matrix is generated can be 2x10, 2x30 and etc.
Code:
import random
Pessoa = random.sample(range(1,25),10)
Nota = random.sample(range(1,25),10)
Pessoa.sort()
Nota.sort()
tmp = sum(Nota)
# sorteando um valor
n_escolhido=random.randrange(1,tmp)
print('Numero sorteado: ', n_escolhido)
I did using list instead of array but stopped at this point because I can not match the list of people with the intervals of the notes.