My beginner python project (calculator) is having trouble with inputs
<p>Whenever I test my calculator to see how it deals with inputs that are not numbers, it flags up a ValueError. More precisely, this one "ValueError: could not convert string to float: 'a'". I have tried to amend this so there is a solution to dealing with non-integers but to no avail... Help is much appreciated.</p>

<p>Here is my code so far:</p>

<pre><code>print("1. ADDITION ")
print("2. MULTIPLICATION ")
print("3. TAKEAWAY ")
print("4. DIVISION ")

Operator = int(input("please enter one of the numbers above to decide the operator you want. "))

while Operator &gt; 4:
    print("Please select a number from the options above. ")
    Operator = int(input("please enter one of the numbers above to decide the operator you want. "))
    if Operator != (1 or 2 or 3 or 4):
        print("please enter one of the options above. ")
        Operator = int(input("please enter one of the numbers above to decide the operator you want. "))
    continue

while True:
    Num1 = float(input("Please enter first number. "))
    if Num1 == float(Num1):
        print("thanks! ")
    elif Num1 != float(Num1):
        Num1 = float(input("Please enter first number. "))
    break

while True:
    Num2 = float(input("Please enter second number. "))
    if Num2 == float(Num2):
        print("thanks ")
    elif Num1 != float(Num1):
        Num1 = float(input("Please enter first number. "))
    break
</code></pre>

<p>Please read the docs for handling exceptions:</p>

<p><a href="https://docs.python.org/2/tutorial/errors.html#handling-exceptions" rel="nofollow">https://docs.python.org/2/tutorial/errors.html#handling-exceptions</a></p>

<p>for a float:</p>

<pre><code>try:
    x = float(input("Please enter a number: "))
    break
except ValueError:
    print "Oops!  That was no valid number.  Try again..."
</code></pre>

python