I need help please. I have this program.
col1 = [1,2,3,4,5,6,7,8,10,13,16]
col2 = [2,4,5,6,7,9,11,13,14,15,17,18,19,20,21,22]
col3 = [7,8,10,12,13,14,15,16,17,18,19,23,24,25,27,29,30]
col4 = [9,12,17,18,19,20,22,23,24,25,26,28,30,31,33]
col5 = [20,21,24,25,26,28,30,32,33,34,35]
b1 = [1,3,5,7,8]
b2 = [2,4,6,7,9,10,11,12]
def pickem():
pick1 = random.choice(col1)
pick2 = random.choice( [i for i in col2 if i > pick1] )
pick3 = random.choice( [i for i in col3 if i > pick2] )
pick4 = random.choice( [i for i in col4 if i > pick3] )
pick5 = random.choice( [i for i in col5 if i > pick4] )
bonus1 = random.choice(b1)
bonus2 = random.choice(b2)
return (pick1,pick2,pick3,pick4,pick5,bonus1,bonus2)
print( pickem() )
I would like the picked number to have a sum total of 3 odd numbers. Is there a way I can do that? It is choosing random numbers from the list I provided above but it will check to see how many of them are odd and if there are less than 3 or whatever amount I put it will pick again until there are 3 odd numbers in total, but only in col1 - col5. So though the final number are seven digits long, I only want to the first 5 digits to have a total of 3 odds. Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire