Google News
logo
Python Program to Addition Operator
In the following example of Python program that demonstrates the use of the addition operator `+` :
Program :
# Addition operator example
a = 5
b = 10
result = a + b

print("The sum of", a, "and", b, "is", result)


In the above program, we start by assigning the integer values `5` and `10` to the variables `a` and `b`, respectively. We then use the addition operator `+` to add `a` and `b` together, and assign the result to the variable `result`.

Finally, we use the `print()` function to print a message that displays the values of `a`, `b`, and `result`, as well as a message indicating that `result` is the sum of `a` and `b`.

When we run the program, it will output the following message :

Output :
The sum of 5 and 10 is 15
As you can see, the program correctly adds `a` and `b` together using the addition operator `+`, and displays the result using the `print()` function.