会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132490个问题

def checkio(text, word):
    text1 = text.lower().replace(' ', '').split('\n')
    # 如果word在text中row相同 enumerate()函数是提供两个参数,为索引和值
    for row, y in enumerate(text1):
        if y.find(word) != -1:
            return [row+1, y.find(word)+1, row+1, y.find(word)+len(word)]
    # 如果word在text中column相同
    text2 = []
    for i in range(len(text1)):
        for j in range(len(text1[i])):
            for k in range(len(text1)):
                text2.append(text1[k][j])
    print(text2)


if __name__ == '__main__':
    print(checkio("""DREAMING of apples on a wall,
And dreaming often, dear,
I dreamed that, if I counted all,
-How many would appear?""", "ten"))
    print(checkio("""He took his vorpal sword in hand:
Long time the manxome foe he sought--
So rested he by the Tumtum tree,
And stood awhile in thought.
And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!""", "noir") == [4, 16, 7, 16])

老师,这是我在check io上遇到的题,我进行到最后一步就卡住了,能不能帮我解决一下,题目是求第二个参数首末单词在第一个参数中的行坐标和列坐标。我的想法是先求行坐标一样的第二参数,而后求列坐标一样的参数。但是列坐标一样的我不知道怎么弄。

微信图片_20210125162124.jpg

Python 全系列/第一阶段:Python入门/控制语句 811楼
Python 全系列/第一阶段:Python入门/序列 815楼


问答.png

老师,请问为什么重新输入超过100的数,运行结果会显示分数不显示等级呢?

Python 全系列/第一阶段:Python入门/控制语句 816楼
Python 全系列/第一阶段:Python入门/控制语句 817楼
Python 全系列/第一阶段:Python入门/面向对象 818楼
Python 全系列/第一阶段:Python入门/Python入门(动画版) 819楼
Python 全系列/第一阶段:Python入门/控制语句 822楼
Python 全系列/第一阶段:Python入门/编程基本概念 824楼
Python 全系列/第一阶段:Python入门/面向对象 825楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637