# Python Subtraction Two Number Example Tutorial

Published On: 17/06/2022 | Category: Python

Hi Guys,

In this tutorial we will go over the demonstration of python substraction two number example tutorial. you will learn how sub two variables in python. In this article, we will implement a python substraction two number example tutorial for beginners. you will learn python substraction program.

So let's see the bellow example:

Example : 1 main.py
```# This program sub two numbers
num1 = 99
num2 = 66

# Substraction two numbers
total = num1 - num2

# Display the substraction
print('The Substraction of {0} and {1} is {2}'.format(num1, num2, total))
```
Output :
```The Substraction of 99 and 66 is 33
```
Example : 2

In this second example i will give you sub 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 num1 and num2. Then, the variables num1 and num2 are sub using the arithmetic operator - and the result is stored in the variable substraction.

main.py
```# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

# Substraction two numbers
total = float(num1) - float(num2)

# Display the sub
print('The Substraction of {0} and {1} is {2}'.format(num1, num2, total))
```
Output :
```Enter first number: 100
Enter second number: 50
The Substraction of 100 and 50 is 50.0
```
Run python file:
```python3 main.py
```
Output