Skip to content

Commit a2a14cb

Browse files
author
fanxiuping
committed
0001
1 parent a32d9f7 commit a2a14cb

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎DockerFan/0001/0001.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding:utf-8 -*-
2+
#第 0001 题:**做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用**生成激活码**(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)
3+
#by DockerFan random.choice
4+
import random, string
5+
6+
7+
8+
def random_series(count,len=10):
9+
str='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
10+
series_set =[]
11+
12+
for i in range(0,count):
13+
series = ''
14+
for j in range(0,len):
15+
series += random.choice(str)
16+
if series not in series_set:
17+
series_set.append(series)
18+
print series
19+
20+
random_series(20)
21+
22+

0 commit comments

Comments
 (0)