Do i have to use try: and except ValueError?
<p>I'm still new to python. 
Do I have to use try: and except ValueError? 
If not when would and should I use them?
Some parts work with and without it
E.g</p>

<pre><code>Def Main_Menu():
    Main_menu_op = input("A.Start \nB.Options \nC.Exit")
    Try:
        if Main_menu_op == "A" or "a":
            Start()

        elif Maim_menu_op == "B" or "b":
            Options()

        elif Main_menu_op == "C" or "c":
            Exit()
    except ValueError:
       print("error")
       Main_menu()
</code></pre>

<p>I just typed this since I'm on my tablet and not my pc so just ignore any mistakes </p>

<p>P.s this is part of a text based game I'm working on </p>

<p><code>try</code> <code>except</code> blocks are to enclose code that might produce a runtime error. The optional argument of Error type (in this case you have input <code>ValueError</code>) will change the block so that it will only catch that type of exception. In your example it looks like you are trying to produce an error message if none of the given options are correctly chosen.</p>

<p>As written, none of the if statements will pass if a different input is received, but no exception will be generated. Instead of try:except, you should likely just use an additional <code>else</code> block onto your <code>if</code> statement. True exceptions are generally reserved for exiting the code when it tries to do something illegal like divide by 0. If you wanted to <a href="https://docs.python.org/3/tutorial/errors.html#user-defined-exceptions" rel="nofollow">create your own</a> custom exception to mimic illegal behavior, you would have to test for when it should be raised (likely with an if statement) then call  <code>raise</code> with your custom exception.</p>

<p>I would also like to point out that in your <code>if</code> and <code>elif</code> conditions, I think you are mistaking the operator precedence of <code>==</code> and <code>or</code>. the equivalence operator: == will be called first because of operator precedence producing either a true or false value then the or will be evaluated. the true or false value will be compared to a non-empty string (<code>'a'</code>, <code>'b'</code>, or <code>'c'</code>) which will always evaluate to true. Instead you could add another == comparison for something like: <code>if Main_menu_op == "A" or Main_menu_op == "a":</code></p>

python