mRyan
mRyan

Reputation: 400

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

Upvotes: 0

Views: 46

Answers (1)

Dadep
Dadep

Reputation: 2788

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".)

Upvotes: 2

Related Questions