In this python program, we will **take two numbers from user and display larger and smaller number **in python, which can compare these two numbers and print larger and smaller number depending upon the user-entered input.

Also, we will discuss how to **c**heck equality of both number in python

## Identify larger and smaller number in python

Let us see how we can **compare and display larger and smaller number in python**

## Program Logic:

- Take two number as input from user using input method
- Use if-else block to check which number is larger or smaller
- Display larger and smaller number using print statement

**Below is implementation code / Source code**

```
# python program to find smaller and larger number
#take two number from user
num1 = int(input("Enter first number :"))
num2 = int(input("Enter second number :"))
if (num1 > num2):
print(num1,"is larger than",num2)
elif (num1 == num2):
print(num1,"is equal to",num2)
else :
print(num1,"is smaller than",num2)
```

## Explanation:

Here, we ask the user to enter first and second number of their choice. If the first number is greater than second number then it will display ” first number is larger than second number” else it will display “first number is smaller than second number”. If both numbers are equal then we it will display “first number is equal to second number”

**Below is output of above code**

>>> %Run 'smaller and larger number.py' Enter first number :23 Enter second number :34 23 is smaller than 34 >>> %Run 'smaller and larger number.py' Enter first number :34 Enter second number :33 34 is larger than 33 >>> %Run 'smaller and larger number.py' Enter first number :23 Enter second number :23 23 is equal to 23 >>>