The following example code shows a Program to Find Sum of Numbers Entered by the User in Python. To begin with, we need the input data from the user. In order to take input from users, we use the input() method of python. Also, we need variables to store user input. So, we take variables x and y. However, the input that we accept from the user is of type string. Because the input() method always returns a string. After that, we take another variable z. So, the variable z computes the sum. In order to convert the string type input to integer, we use the int() method of python. Hence, the variable z computes the integer sum. Otherwise, the ‘+’ operator concatenates the two input strings.
Finally, we use the print() method to display the sum. In order to concatenate, the string ‘Sum =’ with the sum we use the ‘+’ operator. However, it requires both operands to be strings. so, we convert the integer sum to a string. Therefore, we use the str() operator. Hence, we get the desired output.