title: Properly terminate script without error message in Spyder
body: <p>SO for my project in python, I am taking two inputs say a &amp; b as integer values. Now the code goes like:</p>
  
  <pre><code>import sys
  a = input("enter a")
  b = input("enter b")
  if a &lt; b:
      print(" enter a greater than b and try again")
      sys.exit()
  
  # Rest of the code is here
  </code></pre>
  
  <p>Now this works fine. But creates an extra statement </p>
  
  <pre><code>An exception has occurred, use %tb to see the full traceback.
  
  SystemExit
  </code></pre>
  
  <p>And I do not want that as the user may think that the code's functioning is not proper. So is there any way that this statement is not shown or any other function which would exit the code without printing anything except the line which I have written?</p>
  
  <p><strong>NOTE</strong> I have tried exit() but it continues to execute the code beneath it. Also, I have noticed <a href="https://stackoverflow.com/q/19747371/1025391">this related question</a> but the approaches listed there don't work in this case.</p>
  
  <p><strong>EDIT</strong>: I am adding some more information. I need to put this exit function into a user-defined function so that every time the user enters some wrong data, the code will call this user-defined function and will exit the code.
  If I try to put my code in an if else statement like</p>
  
  <pre><code>def end():
      print("incorrect input try again")
      os.exit()
  
  a = input("enter data")
  if a &lt; 10:
      end()
  b = input ("enter data")
  if b &lt; 20:
     end()
  # more code here
  </code></pre>
  
  <p>I don't know why but I can't even define this user-defined function in the end as it raises the error of undefined function end(). I'm using Python with <a href="https://pythonhosted.org/spyder/" rel="nofollow noreferrer">Spyder</a> on Windows.</p>