The seventh day of Python learning - random code generation

 1 #coding=utf-8
 2 #Version:python 3.6.0
 3 #Tools:Pycharm 2017.3.2
 4 _date_ = '2018/4/24/024 15:11'
 5 
 6 
 7 import random
 8 
 9 check_code = ''
10 for i in range(6):
11     current = random.randint(1,2)
12     if current == 1:
13         current = chr(random.randint(65,90))
14     else:
15         current = random.randint(0,9)
16     check_code += str(current)
17 print(check_code)
View Code
E:\ProgramData\Anaconda3\python.exe D:/Python_proc/s14/week5/day2/random_test.py
Q69R28

Process finished with exit code 0

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324810637&siteId=291194637