Skip to content

Instantly share code, notes, and snippets.

@KimBoWoon
Created January 20, 2015 09:23
Show Gist options
  • Save KimBoWoon/e55151c48fc2f18c3053 to your computer and use it in GitHub Desktop.
Save KimBoWoon/e55151c48fc2f18c3053 to your computer and use it in GitHub Desktop.
로또 함수
__author__ = '보운'
from random import *
def initDic():
returnDic = {}
for i in range(1, 46):
tempDic = {i: 0}
returnDic.update(tempDic)
return returnDic
def playLotto(dic):
for i in range(1000):
Lotto = makeLotto()
dic = count(Lotto, dic)
return dic
def makeLotto():
ballList = list(range(1, 46))
shuffle(ballList)
return ballList[0:6]
def count(Lotto, dic):
for num in Lotto:
dic[num] += 1
return dic
Dic = initDic()
Dic = playLotto(Dic)
print(Dic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment