Raymond Hettinger <[email protected]> added the comment:
In Python 3.1, the input() function always returns a string. In your
case, the string is "21". Adding two strings together gives you a
longer string: "12" + "34" --> "1234".
To get your program to do what you want, convert the string to a number
using int():
a = int(input('give a number: '))
b = int(input('and another: '))
print('the sum is', a + b)
----------
nosy: +rhettinger
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7393>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com