So my problem is that in this lottery, you must select 6 numbers from the numbers 1 through 49. I have to do this with recursion and without itertools. I am really stuck as how else to continue to write my code.
Example input: 1 2 3 4 5 6 7
Output:
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 6 7
1 2 3 5 6 7
1 2 4 5 6 7
1 3 4 5 6 7
2 3 4 5 6 7
So I have my base case and everything else except the else
part:
def lottery( number ):
if len( number ) == 6:
return number
else:
I have tried this but it does not work:
else:
output = list()
for i in range( len( numbers ) ):
rem = lotto( numbers[i+1:] )
output.append( numbers[ :i] + rem )
return output