examples/basics/add.py
from __future__ import print_function def main(): a = raw_input('First number: ') b = raw_input('Second number: ') print(a + b) main()
First number: 2 Second number: 3 23
When reading from the command line using raw_input(), the resulting value is a string. Even if you only typed in digits. Therefore the addition operator + concatenates the strings.
Remember, in Python 3 we would write input() instead of raw_input()