擅长:python、mysql、java
<p>您应该使用<a href="https://docs.python.org/3/library/functions.html#enumerate" rel="nofollow noreferrer">^{<cd1>}</a>为您处理跟踪索引</p>
<pre><code>vowels = set('aeiou')
def find_first_vowel(word):
for index, letter in enumerate(word):
if letter in vowels:
return index
return index # Returns last index if no vowels. You could also return None, or raise an error
</code></pre>