Last active
August 29, 2015 14:05
-
-
Save kenchangh/7b0f3b327e13bb3d83ff to your computer and use it in GitHub Desktop.
Generates random I.C. numbers, well... for fun.
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
########## | |
from random import randrange, choice | |
########## | |
def generate_ic(times=10): | |
YEAR = 97 | |
PLACE = 10 | |
ic_list = [] | |
def str_everything(*args): | |
args = list(args) | |
for index, arg in enumerate(args): | |
if arg < 10: | |
args[index] = '0' + str(arg) | |
else: | |
args[index] = str(arg) | |
return args | |
for i in range(times): | |
month = randrange(1,12) | |
day = randrange(1,30) | |
ic = randrange(1000, 9000) | |
complete_ic = ''.join(str_everything(YEAR, month, | |
day, PLACE, ic)) | |
ic_list.append(complete_ic) | |
return ic_list | |
def arrange_ic(times=10): | |
ic_list = generate_ic(times) | |
ic_list = [{'ic': ic, | |
'status': choice(['Diterima', | |
'Tidak Diterima']), | |
} for ic in ic_list] | |
return ic_list | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment