[Tutor] string integers?

amt 0101amt at gmail.com
Mon Feb 13 01:04:41 CET 2012


Hello William and welcome to the Python list. I'm a beginner  but I'll
give it a shot.

Problem is, you use raw_input and it returns a string, not an int.
Try this code:

str1 = raw_input("Type in a String: ")
str2 = raw_input("Type in a String: ")
int1 = int(raw_input("Type in a integer variable: "))
int2 = int(raw_input("Type in a integer variable: "))
print "{0}{1}{2}".format(str1, str2, int1*int2)


More information about the Tutor mailing list