Skip to content

Instantly share code, notes, and snippets.

@WinstonN
Created March 23, 2021 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WinstonN/faae67fff700838cd06d30291645f4a3 to your computer and use it in GitHub Desktop.
Save WinstonN/faae67fff700838cd06d30291645f4a3 to your computer and use it in GitHub Desktop.
Simple Lotto number generator, with powerball
# Try and guess the lotto numbers
# http://lottoresults.co.nz/tools/lotto/number-analysis
import random
numbers_count = 6
powerball_numbers_count = 1
numbers = [
19,
1,
15,
22,
23,
32,
17,
35,
26,
12,
10,
18,
16,
40,
24,
11,
30,
31,
20,
21,
37,
13,
25,
38,
2,
39,
4,
29,
7,
36,
28,
14,
27,
9,
6,
3,
34,
5,
8,
33
]
powerball_numbers = [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
]
def get_frequent_numbers():
"""
Simple method to print out numbers
:return:
"""
print('numbers',numbers)
print('powerball_numbers', powerball_numbers)
def generate_numbers(lines, print_output=False):
"""
Generate lotto numbers, and print output
:param lines:
:param print_output:
:return:
"""
# print(f'generating lotto numbers for {lines} lines')
for line in range(lines):
line_numbers = []
i = 1
while len(line_numbers) < 6:
selected_number = random.choice(numbers)
if selected_number not in line_numbers:
line_numbers.append(selected_number)
i += 1
if print_output:
print(f'line {line+1}: ', line_numbers, random.choice(powerball_numbers))
# main entrypoint
if __name__ == '__main__':
# get_frequent_numbers()
dice_min = 1
dice_max = 1000000
dice = random.randint(dice_min, dice_max)
# dice = 520000
# print(dice)
print(f'dice is: {dice}')
for i in range(dice):
i += 1
if i == dice:
generate_numbers(10, True)
else:
generate_numbers(10)
@WinstonN
Copy link
Author

Output

❯❯❯ python main.py
dice is: 749915
line 1:  [32, 17, 28, 8, 34, 38] 3
line 2:  [4, 5, 23, 31, 7, 13] 1
line 3:  [8, 30, 7, 12, 22, 21] 7
line 4:  [12, 18, 36, 3, 4, 17] 5
line 5:  [9, 39, 17, 30, 24, 7] 10
line 6:  [32, 1, 28, 16, 9, 34] 3
line 7:  [35, 12, 34, 6, 21, 20] 6
line 8:  [11, 28, 25, 34, 33, 31] 4
line 9:  [4, 7, 39, 27, 38, 6] 7
line 10:  [36, 37, 19, 26, 5, 17] 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment