【问题标题】:Attempting to write code to search a list of words for words with atleast two double letters尝试编写代码以在单词列表中搜索至少有两个双字母的单词
【发布时间】:2013-02-27 20:28:42
【问题描述】:
def three_doubles(s):
      for i in range(0, len(s)-5);
        if s[i] = s[i+1] and s[i+2] == s[i+3] and s[i+4] == s[i+5]:
          return True
       return False

尝试修改此代码以搜索具有至少两个连续双字母的单词

【问题讨论】:

    标签: python list


    【解决方案1】:

    我没完全明白你问的是什么。

    l=['asd','aabb','ccddee']
    for w in l:
        if len(w)>1:
            if len(w)==(2*len(set(w))):
                print w
    

    【讨论】:

    • @user2117024 是你想要的吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多