import re
def multi_vowel_words(text):
pattern =r"\b\w[aeiou]{3,},?\s?.*\w[aeiou]{3,}.*\b"
result = re.findall(pattern, text)
return result
Run Code Online (Sandbox Code Playgroud)
我哪里做错了
运行我的代码后我得到这个:
[]
['queen is courageous and gracious']
['quietly and await their delicious dinner']
[]
[]
#below this are desired outputs
print(multi_vowel_words("Life is beautiful"))
# ['beautiful']
print(multi_vowel_words("Obviously, the queen is courageous and
gracious."))
# ['Obviously', 'queen', 'courageous', 'gracious']
print(multi_vowel_words("The rambunctious children had to sit quietly and
await their delicious
dinner."))
# ['rambunctious', 'quietly', 'delicious']
print(multi_vowel_words("The order of a data queue is First In First Out
(FIFO)"))
# ['queue']
print(multi_vowel_words("Hello world!"))
# []
print(multi_vowel_words("The order of a data queue is First In First Out
(FIFO)")) # ['queue']
print(multi_vowel_words("Hello world!")) # []
Run Code Online (Sandbox Code Playgroud)
试图尝试回答这个问题。用一个简单的模式来检查三个连续的元音怎么样
def multi_vowel_words(text):
pattern =r"\b\w*[aeiou]{3,}\w*\b"
result = re.findall(pattern, text)
return result
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6350 次 |
| 最近记录: |