0
I have a list of 21 terms and a value that goes from 0 to a random number that varies from zero to the number typed by the user. I need to divide this random number into smaller numbers that add up to random, for example:
The random number generated was 100, I can divide into the numbers 50, 25, 10, 15 (and 17 more zeros) and then add each piece of this into a term I choose from the list (it can’t be random nor in order, it has to be arbitrary)
The problem is I don’t know how to do this, I thought I’d make a for
that contains a random number q varies from 0 to the number typed, but not even assemble that I know, any idea?
(The scheme would be in the form:
x = randint (0,pat) #pat é a variável digitada pelo usuário
x2 = randint (0,pat - x)
x3 = randint (0,pat - x2)
Up until (pat
minus the variable give zero), where the zero number would simply be repeated several times)
Buddy, you’re still confused what you want, that’s the whole code ?
– FourZeroFive
The beginning of the code consists of three lists, with different sizes. The user must enter a number that will be divided into 3 random percentages. This means that I will have three numbers, each associated with one of the lists (One of these numbers is the pat variable). With pat I need to divide it again, in the number of times of the list associated with it and add to each variable this value, which can be equal to zero. @Fourzerofive
– Marcos Matsuura Ayres
This issue is very confused. It is not clear whether it is the
inputs
nor theoutputs
. On this issue it was not clear, with which lists we should work, the type of variable of the list, nor the range of such lists. It was not clear what percentages would be. Very confusing this question.– Solkarped