Skip to content

Instantly share code, notes, and snippets.

@ronsims2
Last active August 29, 2015 14:13
Show Gist options
  • Save ronsims2/11846c9c5dc4fadda2d5 to your computer and use it in GitHub Desktop.
Save ronsims2/11846c9c5dc4fadda2d5 to your computer and use it in GitHub Desktop.
Lotto Generator - Complex for no good reason
import random
def getNum(start = 1, end = 75, stringify = True):
lottoNum = random.randint(start,end)
if stringify:
lottoNum = str(lottoNum)
return lottoNum
def getNums(qty = 6, start = 1, end = 75, randos = None):
lotto = []
for q in range(0, qty):
lotto.append(getNum(start, end))
if randos != None:
for r in randos:
lotto.append(getNum(r[0], r[1]))
return lotto
def printLotto(lotto = None):
if lotto == None:
lotto = getNums(6, 1, 75, ((1,15),))
msg = "Your lucky numbers are: "
for l in lotto:
if type(l) is int:
l = str(l)
msg += l + " "
msg = msg.strip() + "."
print(msg)
printLotto()
print ("No we pick our own")
printLotto((3,5,9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment