18
How To Make A Simple Number Comparer In Python
In this article I will show you how to make a extremely simple number comparer!
This program will compare two numbers and tell which one is greater.
This is a great project to improve your skills! As they say, practice makes perfect.
First, we need to make the inputs so that the user can input their desired values.
num1 = int(input("❯ Enter A Number: "))
num2 = int(input("❯ Enter Another Number: "))
Lastly, we need to write if
and else
statement to and use the comparing operators <, >, =
to check which number is greater.
if num1 > num2:
print("❯ " + str(num1) + " is greater than " + str(num2))
else:
print("❯ " + str(num2) + " is greater than " + str(num1))
18