Search code examples
pythonpython-2.7mathintegeraddition

Adding two int's


why can't I add these together?

a = int(input("input a number to add"))
b = int(input("input a number to add"))
a + b = c
print(c)

can't assign to operator


Solution

  • you can't do a+b=c you should do c=a+b because you can't give the non existing value c to something named a+b (when you do c = a + b you assign the result of the operation "a+b" in a variable named "c".)