Message95712
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) |
|
Date |
User |
Action |
Args |
2009-11-25 07:19:23 | rhettinger | set | recipients:
+ rhettinger, mayur78 |
2009-11-25 07:19:23 | rhettinger | set | messageid: <1259133563.74.0.760150763287.issue7393@psf.upfronthosting.co.za> |
2009-11-25 07:19:22 | rhettinger | link | issue7393 messages |
2009-11-25 07:19:22 | rhettinger | create | |
|