鱼C论坛

 找回密码
 立即注册
查看: 939|回复: 3

第20讲动动手

[复制链接]
发表于 2018-11-26 21:09:38 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
有没有大神解释一下这套题啊,countA,B,C 代表什么意思?为什么我把小甲鱼的程序抄下来运行结果不对


20题

20题
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2018-11-26 22:34:30 | 显示全部楼层
是照抄的不?你把原码贴出来看看
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-11-28 19:32:32 | 显示全部楼层
ba21 发表于 2018-11-26 22:34
是照抄的不?你把原码贴出来看看

str1='''ABCiADFkASDiADFIJKL'''
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
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-11-28 20:02:54 From FishC Mobile | 显示全部楼层
Moo629 发表于 2018-11-28 19:32
str1='''ABCiADFkASDiADFIJKL'''
countA=0
countB=0

countA代表前三位大写,countB代表小写,countC代表后三位大写。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-1-10 08:07

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表