Created
March 23, 2021 23:13
-
-
Save WinstonN/faae67fff700838cd06d30291645f4a3 to your computer and use it in GitHub Desktop.
Simple Lotto number generator, with powerball
This file contains 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
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output