Python Program to Compare Two Numbers – Programming Code Examples

Python Program to Compare Two Numbers1 min read

In this  Python Example, I’ll show how to compare two numbers using if else if statements.

We use the following operators for comparison in Python. In this example we will perform a simple comparison process.


Compare Two Numbers

Variables are defined in the first row. In the next lines, values are assigned to these variables. Then  Numbers compare in if statement.

In the last line we print the result of processing on the screen.

Python Code:

1 Comment

  • #Take two numbers from the user to compare
    num1 = int(input(“50:”))
    num2 = int(input(“70:”))
    # Compare both the number
    if num1 num2):
    print(“50 > 70.”)
    else (num1 50.”)
    Literally! can’t find the mistake Help me please!

Leave a Comment