How do I find the first occurrence of a vowel and move it behind the original word (pig latin)?
<p>I need to find the first vowel of a string in python, and I'm a beginner. I'm instructed to move the characters before the first vowel to the end of the word and add '-ay'. For example "big" becomes "ig-bay" and "string" becomes "ing-stray" (piglatin, basically).</p>

<p>This is what I have so far:</p>

<pre><code>def convert(s):

    ssplit = s.split()
    beginning = ""
    for char in ssplit:
        if char in ('a','e','i','o','u'):
            end = ssplit[char:]
            strend = str(end)
        else:
            beginning = beginning + char
    return strend + "-" + beginning + "ay"
</code></pre>

<p>I need to find a way to stop the "if" statement from looking for further vowels after finding the first vowel - at least I think it's the problem.  Thanks!</p>

<p>You can use a <code>break</code> statement as soon as you found a vowel. 
You also do not need to use any <code>split()</code> functions.
One big mistake you did was using <code>char</code> to get the <code>SubString</code>. You need to use the index of that char to get the <code>SubString</code> instead.</p>

<p>Take a look at this:</p>

<pre><code>def convert(s):
    beginning = ""
    index = 0;
    for char in s:
       if char in ('a','e','i','o','u'):
           end = str(s[index:])
           break
       else:
           beginning = beginning + char
       index = index + 1
    return str(end) + "-" + beginning + "ay"
</code></pre>

python findfirst