I tried this:
a = input()
print("+")
b = input()
c =a+b
print(c)
But it output 55 instead of 10 when I input 5 + 5
I tried this:
a = input()
print("+")
b = input()
c =a+b
print(c)
But it output 55 instead of 10 when I input 5 + 5
If you run print(5+5)
you will get 10
.
If you run print('5'+'5')
you will get 55
because the +
operator will concatenate strings together.
You are concatenating strings instead of adding integers, you can use int()
to convert from string to integer and str()
to convert from integer to string.