Python Subtraction Operator

In Python, Arithmetic Subtraction Operator takes two operands and returns the difference of second operand from first operand.

Syntax

The syntax to find the subtraction of two numbers: a and b using Subtraction Operator is

a - b

The above expression returns a number.

ADVERTISEMENT

Example

In the following program, we take two numbers: a, b; and find the difference a - b.

main.py

a = 5
b = 4

result = a - b

print(result)
Try Online

Output

1

Conclusion

In this Python Tutorial, we learned about Subtraction Arithmetic Operator, its syntax, and usage, with examples.