零基础入门python第二十讲 找密码 为什么与标准答案有区别啊 :
要求:每位密码为单个小写字母
每位密码的左右两边均有且只有三个大写字母
count=-1
for each in str1:
count+=1
if each.islower()==True and str1.isupper()==True and str1.isupper()==True and str1.islower()==True and str1.islower()==True:
print(each ,end='')
谢谢{:5_100:} 索引当然不能从第一个字符开始 考虑的不周全呀
比如说 ① 前3个字母 和后3个字母在运行的时候,会导致数组下标出问题的 str1
② AAAbCCC,如果遇到开头就是符合的字符串你的程序是检测不出来的,因为你的程序还判断了前面第四个字母,可是根本没有啊
重新理一下思路吧,并且要考虑可能会有的坑
页:
[1]