-3

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

gustgr
  • 152
  • 9
  • 1
    Please don't post images of code. Codes are text, so post them as text. See the **Code Blocks** section of the [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting). – Gino Mempin Jul 02 '19 at 23:57
  • It would be better if you wrote the code directly into the question rather than link to an image of it. Makes it easier for future viewers. – Vincent Ramdhanie Jul 02 '19 at 23:58

2 Answers2

0

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.

Rob Kwasowski
  • 2,690
  • 3
  • 13
  • 32
0

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.

jacalvo
  • 656
  • 5
  • 14