Can't assign to function call, yet code seems correct
<p>I was making a VERY simple calculator, because I was bored, but for some reason it errors out with 'Can't assign to function call'.
This is the code:</p>

<pre><code>type=input("Please select a method.\n\n1.) Addition\n2.) Subtraction\n3.) Multiplication\n4.) Division\n\n")
if type == "1":
    int(number1)=input("First number?")
    int(number2)=input("Second number?")
    answer=number1+number2
    print ("The answer is " +answer +".")
if type == "2":
    int(number1)=input("First number?")
    int(number2)=input("Second number?")
    answer=number1-number2
    print ("The answer is " +answer +".")
if type == "3":
    int(number1)=input("First number?")
    int(number2)=input("Second number?")
    answer=number1*number2
    print ("The answer is " +answer +".")
if type == "4":
    int(number1)=input("First number?")
    int(number2)=input("Second number?")
    answer=number1/number2
    print ("The answer is " +answer +".")
else:
    print("Pick a number from 1-4")
</code></pre>

<p>I feel like this is very obvious and I'm just being an idiot.</p>

<p>You are casting your variables to <code>int</code> at the wrong time. You need to cast the input given to you as an integer, rather than cast the variable to an integer before a string value is given to you.</p>

<p>All instances similar to <code>int(number1)=input("First number?")</code> need to be changed to <code>number1 = int(input("First number?"))</code>.</p>

<p>This is called <a href="https://docs.python.org/2/reference/expressions.html" rel="nofollow">precedence</a>.</p>

python python-3.x