Python练习册,第 0001 题
2018-04-09 16:40
302 查看
第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random import string codesnumber = 200 codeslength = 12 def makeACode( length ): codes = ''; for i in range(length) : codes += random.choice(string.ascii_letters + string.digits) return codes; def makeCodes( numbers, length ): codesset = []; for i in range(numbers): codesset.append(makeACode(length)) return codesset print makeCodes(codesnumber, codeslength)
相关文章推荐
- Python 练习册,每天一个小程序-第 0001 题
- python练习册第一题
- python练习册之六
- Python 练习册 0-头像右上角添加数字
- python练习册之11
- python练习册之14 15 16
- Show me the code之Python练习册 Q1~3 优惠券
- Python 练习册 0-头像右上角添加数字
- Python 练习册,每天一个小程序 -- 0002题
- Show me the code之Python练习册 Q4~7
- Python 练习册 1-生成激活码
- Python 练习册--存入数据库(Mongodb,MySQL)操作
- Python 练习册,每天一个小程序
- Show me the code之Python练习册 Q8~9 html解析
- Python 练习册 2-存储激活码到MySQL数据库
- Python 练习册,每天一个小程序(0001)
- 【练习册】 2015-08-09 Dlist Queue Stack by python
- Python 练习册,每天一个小程序(0002)
- python练习册第四题
- Python 练习册 3-存储激活码到Redis数据库