Skip to content

Commit 82da89b

Browse files
committed
Add solution of 0001
1 parent 5b1ad2c commit 82da89b

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

illuz/0001/key_generator.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
# Author: illuz <iilluzen[at]gmail.com>
4+
# File: key_generator.py
5+
# Create Date: 2015-02-09 10:43:36
6+
# Descripton: Use uuid module to generate 200 register keys.
7+
# Usage: key_generator.py
8+
9+
"""
10+
第 0001 题:
11+
做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
12+
"""
13+
14+
from uuid import uuid4
15+
16+
def generate_key(num):
17+
key_list = [str(uuid4()) for i in range(num)]
18+
return key_list
19+
20+
21+
def main():
22+
print generate_key(200)
23+
24+
25+
if __name__ == '__main__':
26+
main()
27+

0 commit comments

Comments
 (0)