|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 wjhzj 于 2022-10-30 14:35 编辑
为什么运行课后题答案的这个代码没有输出呀,符合条件的有‘loveyou’字符串呀?
str1 = '12345AabcBcdeC678000...出发...love...冲鸭...youDfgh54321Eijk9876Fyyy0'
countA = 0
countB = 0
countC = 0
length = len(str1)
for i in range(length):
if str1[i] == '\n':
continue
if str1[i].isupper():
if countB == 1:
countC +=1
countA = 0
else:
countA += 1
continue
if str1[i].islower() and countA == 3:
countB = 1
countA = 0
target = i
continue
if str1[i].islower() and countC == 3:
print(str1[target],end = '')
countA = 0
countB = 0
countC = 0
密码提取条件是这个
1.每位密码是单个小写字母
2.每位密码的左右两边均有且只有三个大写字母 |
|