Skip to content

Commit

Permalink
Merge pull request #101 from stingroc/master
Browse files Browse the repository at this point in the history
Add my files
  • Loading branch information
horx committed May 7, 2015
2 parents 8fc4fc7 + a90b028 commit b705cbe
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions stingroc/0001/0001.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import random

if __name__ == "__main__":
NUM_OF_TICKET = 20
LENGTH_OF_TICKET = 10

char_lst = []

def get_lst(lst, c1, c2):
char_lst = lst[0]
for i in range(ord(c1), ord(c2) + 1):
char_lst.append(chr(i))

get_lst([char_lst], '0', '9')
get_lst([char_lst], 'a', 'z')
get_lst([char_lst], 'A', 'Z')

def gen_ticket():
single_ticket_lst = [char_lst[random.randint(0, len(char_lst) - 1)]
for i in range(LENGTH_OF_TICKET)]

return "".join(single_ticket_lst)

result = set()
while len(result) <= NUM_OF_TICKET:
result.add(gen_ticket())

print result

0 comments on commit b705cbe

Please sign in to comment.