def checkio(words: str) -> bool:
split_words = words.split()
count = 0
for w in split_words:
if w.isalpha():
count += 1
while count == 3:
return True
break
elif w.isdigit():
count = 0
if count == 3:
return True
checkio('one two 3 four five six 7 eight 9 ten eleven 12')
本人千方百计试图将 for 循环里边的 count 变为 3 后返回 true 后解决题目,但不管如何返回的都是 False.
除此之外,为什么 for 循环里边 w 是一个字符串而不是这个列表的索引值。
split_words = words.split()
count = 0
for w in split_words:
if w.isalpha():
count += 1
while count == 3:
return True
break
elif w.isdigit():
count = 0
if count == 3:
return True
checkio('one two 3 four five six 7 eight 9 ten eleven 12')
本人千方百计试图将 for 循环里边的 count 变为 3 后返回 true 后解决题目,但不管如何返回的都是 False.
除此之外,为什么 for 循环里边 w 是一个字符串而不是这个列表的索引值。