a=input("type sentence: ") for i in range(1, 100): if a[i] == 'a': print (a[i]) elif a[i] == 'o': break
According to my experience, in C, we can use a[i] with for to check each index of a string array from a[0] to a[i]. However, whenever I use the same method in Python I get the error "IndexError: string index out of range". What is the problem in this case?
My goal is to check if the sentence I wrote has vowels and if it does, print the first vowel. I tried listing, but problem got worse.