mardi 1 janvier 2019

Generating set of semi-random numbers with some guaranteed present

I am attempting to create a Python 3 script which prints out all possible sets of 6 numbers, 4 of which are fixed (must appear), but can appear anywhere in the 6. The numbers also must all be between 0 and 9.

For instance, if the "fixed" numbers are 1,2,3,4, then 1,2,4,3,5,7 is acceptable, 1,2,3,3,4,4 is also acceptable, but 0,4,3,7,8,2 or 8,0,5,6,7,8 are not and should not be printed.

I have attempted so solve this so far, but have run into a mental roadblock when it comes to conceptually understanding where exactly to get started on this.

Any help is greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire