Last active
March 18, 2023 05:06
-
-
Save richiverse/a42ca04d6734a345850f to your computer and use it in GitHub Desktop.
Python powerball number generator
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
#!/usr/bin/env python | |
""" | |
If you happen to win, I only ask for a measly 1% tip. ;) | |
To run, save this file and run it by typing the following in your terminal: | |
python powerball.py | |
""" | |
from pprint import pprint as pp | |
import random | |
def powerball(): | |
drum1 = list(range(1,70)) | |
drum2 = list(range(1,27)) | |
white_balls = [] | |
for _ in range(5): | |
choice = random.SystemRandom().choice(drum1) | |
drum1.pop(drum1.index(choice)) | |
white_balls.append(choice) | |
white_balls = sorted(white_balls) | |
return white_balls + [random.SystemRandom().choice(drum2)] | |
try: | |
budget = int(int(input('What is your powerball budget? (Number must be multiple of 2)'))/2) | |
except: | |
budget = 1 | |
pp(list(powerball() for i in range(budget))) |
Ee
26-27-43-61-69 (4) next predictions powerball
from pprint import pprint as pp
import random
def powerball():
drum1 = list(range(1,70))
drum2 = list(range(1,27))
white_balls = []
for _ in range(5):
choice = random.SystemRandom().choice(drum1)
drum1.pop(drum1.index(choice))
white_balls.append(choice)
white_balls = sorted(white_balls)
return white_balls + [random.SystemRandom().choice(drum2)]
try:
budget = int(int(input('What is your powerball budget? (Number must be multiple of 2)'))/2)
except:
budget = 1
pp(list(powerball() for i in range(budget)))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A suggestion mod you might make is to capture http://www.powerball.com/powerball/winnums-text.txt (which is always updated) and run a comparison, against those results, to ensure the generated number doesn't match a previous number that won.