Last active
February 6, 2022 19:27
-
-
Save licensed/0e6fa4726e10597407bff3effcb64b86 to your computer and use it in GitHub Desktop.
Loteria / Mega Sena
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Simple Python Script for generate all possible combinations without repetitions | |
from itertools import combinations | |
# I want all possible combinations without repetition who haves numbers from 1 to 60 | |
NUMBERS = 60 | |
# Each possible combination haves 6 numbers | |
QUANTITY = 6 | |
# Lines quantity by each file | |
LINES = 6000000 | |
# Simple counter to control file lines limit | |
x = 1 | |
for count, comb in enumerate(combinations(range(1, NUMBERS + 1), QUANTITY)): | |
if count > LINES: | |
x += 1 | |
LINES *= 2 | |
with open(f'combination{x}.txt', 'a') as f: | |
f.write(str(comb).replace('(', '').replace(')', '') + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment