-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from stingroc/master
Add my files
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
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 |