If a character in string is found before another character
<p>I'm trying to figure out a way to see if a character in a string before another one to get and output. Say:</p>

<pre><code>v="Hello There"
x=v[0]

if "Hello" in x:
    print("V consists of '"'Hello'"'")
        if "There" in x:
             print("Hello comes before There)

if "There" in x:
    print("V consists of '"'There'"'")
        if "Hello" in x:
             print("There comes before Hello")
</code></pre>

<p>What I'm trying to get is "Hello comes before There", though it doesn't seem to work when I type it in. Help would be greatly appreciated.</p>

<p>The reason why the output would indicate that Hello comes before there is because the script is read from top to bottom, and this is just an exploit of that fact.</p>

<p>If any of this does not make any sense, please feel free to reach me in the answer section.</p>

<p>For string 's', <code>s.find(substring)</code> returns the lowest index of <code>s</code> that begins <code>substring</code></p>

<pre><code>if s.find('There') &lt; s.find('Hello'):
    print('There comes before Hello')
</code></pre>

python string variables if-statement