Ending script with if statement
<p>I'm very new to Python and want to know how to end a program with an if statement that prints a message, as this does not appear to be happening with my 'stand' variable when it is under &lt; 5000.  The if statement bolded ** ** is the code I'm having trouble with and it still prints the message I want, however, the program does not stop with that message but continue going to the next code (countdown variable). Ignore 'countdown'. </p>

<p>Here is a part of my code.</p>

<pre><code>   while stand &lt;= 0 or mission &gt; 10000: 
        try: 
            stand = int(input("Enter a VALID distance in metres: ")) 
        except ValueError: 
            print("Please enter a valid distance E.g 6000: ") 
    **if stand &gt; 0 or stand &lt; 5000: 
        print("ERROR, ERROR") 
        print("Launch cannot begin, the Mission Control and spectator stands are dangerously close at a distance of {}m.".format(mission)) 
        print("This launch site sucks! It must be demolished and rebuilt!") 
        print("Launch delayed.")**                   

    if stand &gt;= 5000: 
        print("Fortunately the mission control and viewing stands are situated far enough.")              
    while countdown == 0 or countdown == "": 
        print("We need a person to countdown.")
        try:
            countdown = int(input("How many seconds would you like the countdown to be?: "))
        except ValueError:
</code></pre>

<p>Use <code>break</code> to exit the loop.</p>

<pre><code>if stand &gt; 0 or stand &lt; 5000:
    print("ERROR, ERROR") 
    print("Launch cannot begin, the Mission Control and spectator stands are dangerously close at a distance of {}m.".format(mission)) 
    break 
</code></pre>

<p>Use <code>exit</code> to exit the program.</p>

<pre><code>import sys
if stand &gt; 0 or stand &lt; 5000:
    print("ERROR, ERROR") 
    print("Launch cannot begin, the Mission Control and spectator stands are dangerously close at a distance of {}m.".format(mission)) 
    sys.exit(0)
</code></pre>

python variables if-statement while-loop