Created
January 20, 2015 09:23
-
-
Save KimBoWoon/e55151c48fc2f18c3053 to your computer and use it in GitHub Desktop.
로또 함수
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
__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