python - How do I match vowels? -


i having trouble small component of bigger program in works on. need have user input word , need print index of first vowel.

word= raw_input("enter word: ") vowel= "aeiouaeiou"  index in word:     if index == vowel:         print index 

however, isn't working. what's wrong?

try:

word = raw_input("enter word: ") vowels = "aeiouaeiou"  index,c in enumerate(word):     if c in vowels:         print index         break 

for .. in iterate on actual characters in string, not indexes. enumerate return indexes characters , make referring both easier.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -