<div><h4id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">raise</span>ValueError(<spanclass="hljs-string">'Argument is of right type but inappropriate value!'</span>)
<spanclass="hljs-keyword">raise</span>TypeError(<spanclass="hljs-string">'Argument is of wrong type!'</span>)
<div><h4id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">raise</span>TypeError(<spanclass="hljs-string">'Argument is of wrong type!'</span>)
<spanclass="hljs-keyword">raise</span>ValueError(<spanclass="hljs-string">'Argument is of right type but inappropriate value!'</span>)
<spanclass="hljs-keyword">raise</span> RuntimeError(<spanclass="hljs-string">'None of above!'</span>)
<div><h2id="exit"><ahref="#exit"name="exit">#</a>Exit</h2><p><strong>Exits the interpreter by raising SystemExit exception.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> sys
sys.exit() <spanclass="hljs-comment"># Exits with exit code 0 (success).</span>
sys.exit(<int>) <spanclass="hljs-comment"># Exits with passed exit code.</span>
sys.exit(<obj>) <spanclass="hljs-comment"># Prints the object and exits with 1 (failure).</span>