We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9050ec commit f81fea7Copy full SHA for f81fea7
1 file changed
Drake-Z/0001/0001.py
@@ -0,0 +1,25 @@
1
+#!/usr/bin/env python3
2
+# -*- coding: utf-8 -*-
3
+
4
+'第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)'
5
6
+__author__ = 'Drake-Z'
7
8
+import random
9
10
+def rndChar(filename, digit=4, num=200):
11
+ f = open(filname, 'a')
12
+ a = 0
13
+ for i in range(1, 201):
14
+ while a < 4:
15
+ f.write(chr(random.randint(65, 90)))
16
+ a += 1
17
+ f.write('\n')
18
+ f.close()
19
+ print('Done!')
20
+ return 0
21
22
+if __name__ == '__main__':
23
+ filname = 'activecode.txt'
24
+ digit = 4
25
+ num = 200
0 commit comments