# How To substraction Two Number in Python ?

Jun 21, 2021

.

Hello Friends,

Now let's see example of how to substraction between two number in python. We will show python substraction two number example. i would like to share with you how to substraction two number in python. In this blog i will learn you how to substraction two variables in python.

Here i will give you substraction two numbers, the user is first asked to enter two numbers and the input is scanned using the input() function and stored in the variables number1 and number2. Then, the variables number1 and number2 are added using the arithmetic operator - and the result is stored in the variable substraction.

So let's see the bellow example:

Example 1

sub.py

```# This program sub two numbers
number1 = 8
number2 = 5

# Substraction two numbers
total = number1 - number2

# Display the substraction
print('The substraction of {0} and {1} is {2}'.format(number1, number2, total))
```

Output :

```The substraction of 8 and 5 is 3
```

Example 2

sub.py

```# Store input numbers
number1 = input('Enter first number: ')
number2 = input('Enter second number: ')

# Substraction two numbers
total = float(number1) - float(number2)

# Display the sub
print('The substraction of {0} and {1} is {2}'.format(number1, number2, total))
```

Output :

```Enter first number: 8.3
Enter second number: 2.1
The substraction of 8.3 and 2.1 is 6.2
```

Run python file:

```python sub.py
```

#Python