|

楼主 |
发表于 2018-10-17 19:58:07
From FishC Mobile
|
显示全部楼层
RIXO 发表于 2018-10-17 18:46
我给你解释下吧,那个就是一个算法模型 A是字母前边的 大写字母个数 他是这样干的 读一个 ...
那我今天下午写成下面这样 为什么会报 invalid syntax错误?想了很久没结果 求指点
def getpasswd():
strr = 'ABSaDKSbRIHcRHGcdDIF'
list1 = []
temp=[]
for y in range(len(strr)):
list1.append(strr(y))
print(list1)
result ='password is:'
for i in list1:
if (i.isalpha()) and (i.islower()):
temp.append(list1.find(i))
print(temp)
for x in range(len(temp)):
if temp(x) == temp(x+1) and temp(x)<3 and temp(x) > len(list1)-4:
temp.remove(temp(x))
temp.remove(temp(x+1)
list1.remove(list1(temp(x)))
list1.remove(list1(temp(x+1)))
temp(x) = int(temp(x))
if list1[temp(x)-3:temp(x)].isalpha() and list1[temp(x)-3:temp(x)].isupper() and list1[temp(x)+1:temp(x)+4].isalpha() and list1[temp(x)+1:temp(x)+4].isupper():
result += list1(temp(x))
print(result)
getpasswd() |
|