I am new here and it's my first post, so I'm sorry if this is in the wrong place or is formatted wrong. I made my first Python
code, which is extremely simple, but I have a few questions I need clarified:
This program asks the user to enter 3 integers, and will add them.
num1 = int(raw_input("Enter an integer"))
num2 = int(raw_input("Enter a second integer"))
num3 = int(raw_input("Enter a third integer"))
ans = num1 + num2 + num3
print "The sum of the 3 integers entered is", ans
I'm trying to make sure I fully understand the basics. Whenever raw_input is used, the program sees the inputted value as a string, so I made sure to convert them to integers. I understand this much. On the line that says "ans = num1 + num2 + num3", is this "ans" variable considered to be an integer, since the num1, num2, and num3 variables were? My main question involves the last line. I know that the part of the line that says "The sum of the 3 integers entered is" is a string. is the ", ans" part at the end still an integer? Also, is there another way I could have written this last line, using a plus sign? I feel like I remember seeing a program where the print statement put the variables in using plus signs or something... I'm sorry if these are silly questions, but programming does not come naturally to me, so I want to be sure I am thinking about this correctly. Thank you.