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.
Making Inputs
First, we need to make the inputs so that the user can input their desired values.
First Number
num1 = int(input("❯ Enter A Number: "))
Second Number
num2 = int(input("❯ Enter Another Number: "))
Writing Logic
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))
That's it, congratulations! You have made a number comparer!
Here is a picture of the finished product:
Top comments (0)