|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 shiyouroc 于 2022-3-23 09:42 编辑
问题:
1.空格太多。
2.函数名没有意义。
3.变量名没有意义
- # coding=utf-8
- #!/usr/bin/python
- # Write Python 3 code in this online editor and run it.
- from random import randint
- from sys import exit
- yes = 1 #设全局变量
- ye = 1 #设全局变量
- g = 1
- xiao=['a','b','c','d','e','f',
- 'g','h','i','j','k','l',
- 'm','n','o','q','p','r',
- 't','s','u','v','w','x','y',
- 'z']
- da = [each.upper() for each in xiao]
- def three_engling():
-
- global yes #将其声明为全局变量!
- global ye #将其声明为全局变量!
- yes = input("是1退0")
- ye = yes.isdigit() #判断字符串是否是数字,是ture 否flase
- print(ye) #打印判断结果
- def dcdy():
- global yes
-
- ffff = len(yes)
- if ffff > 2:
- print('请勿非法输入。')
- cc()
- def tt():
- global yes #将其声明为全局变量!
- global ye #将其声明为全局变量!
-
- while ye == False:
- print('请勿非法输入。')
- yes = input("是1退0")
-
- ye = yes.isdigit()
- if ye == False:
- print('请勿非法输入。')
- cc()
- else:
- break
- def dd():
- global yes #将其声明为全局变量!
- yes = int(yes)
- if yes > 1:
- print('请勿非法输入。')
- cc()
-
- if yes ==0:
- exit(0)
- def sc():
- global g
- y=randint(0,2) #选前三个字母的其中一个字母为小写
-
- if y==0: #如果为零第一个字母为小写
- d=randint(0,25)
- one=xiao[d]
- else:
- d = randint(0,25)
- one = da[d]
-
- if y==1: #如果为1第一个字母为小写
- q= randint(0,25)
- two = xiao[q]
- else:
- q = randint(0,25)
- two = da[q]
-
- if y==2: #如果为2第一个字母为小写
- z=randint(0,25)
- three=xiao[z]
- else:
- z=randint(0,25)
- three=da[z]
-
- numbers = randint(1000000,99999999)
- g=str(one)+str(two)+str(three)+'.'+str(numbers)
- print(g)
-
-
- def gfg(): #把密码写入文本
- global g
- try:
- f =open('three_engling.txt')
- f.close()
- except IOError:
- f =open('three_engling.txt','w+')
- f.write(g)
- f.close() # close()不需要参数
- cc()
-
- else:
- f =open('three_engling.txt','a')
- f.write('\n')
- f.write(g)
- f.close()
- cc()
-
-
- def cc():
- three_engling()
- dcdy()
- tt()
- dd()
- sc()
- gfg()
-
- cc()
复制代码
@python爱好者. @不二如是 |
|