Author rhettinger
Recipients mayur78, rhettinger
Date 2009-11-25.07:19:22
SpamBayes Score 0.00109208
Marked as misclassified No
Message-id <1259133563.74.0.760150763287.issue7393@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2009-11-25 07:19:23rhettingersetrecipients: + rhettinger, mayur78
2009-11-25 07:19:23rhettingersetmessageid: <1259133563.74.0.760150763287.issue7393@psf.upfronthosting.co.za>
2009-11-25 07:19:22rhettingerlinkissue7393 messages
2009-11-25 07:19:22rhettingercreate