Relational Operators


Source Code :1

print("Relational Operator (Less than)Example")
a = int(input("Enter number 1 : "))
b = int(input("Enter number 2 : "))
if a < b:
    print("First number is less than second number")
else:
     print("Second number is less than first number")
To download raw file Click Here

Output :1

Relational Operator (Greater than)Example
Enter number 1 : 10
Enter number 2 : 5
10 is greater than 5

Source Code :2

print("Relational Operator (Less than)Example")
number_1=int(input("Enter number 1 : "))
number_2=int(input("Enter number 2 : "))
if number_1<number_2:
    print(number_1,"is less than",number_2)
else:
    print(number_2,"is less than",number_1)
To download raw file Click Here

Output :2

Relational Operator (Less than)Example
Enter number 1 : 10
Enter number 2 : 20
10 is less than 20

Source Code :3

print("Relational Operator (Equal to)Example")
number_1=int(input("Enter number 1 : "))
number_2=int(input("Enter number 2 : "))
if number_1 == number_2:
    print(number_2,"is equal to",number_1)
else:
    print(number_1,"is not equal to",number_2)
To download raw file Click Here

Output :3

Relational Operator (Equal to)Example
Enter number 1 : 10
Enter number 2 : 10
10 is equal to 10


Source Code :4

print("Relational Operator (Not Equal to)Example")
number_1=int(input("Enter number 1 : "))
number_2=int(input("Enter number 2 : "))
if number_1 != number_2:
    print(number_1,"is not equal to",number_2)
else:
    print(number_1,"is equal to",number_2)
To download raw file Click Here

Output :4

Relational Operator (Not Equal to)Example
Enter number 1 : 20
Enter number 2 : 10
20 is not equal to 10


Source Code : 5

print("Relational Operator (Greater than or  Equal to) Example")
number_1=int(input("Enter number 1 : "))
number_2=int(input("Enter number 2 : "))
if number_1 >= number_2:
    print(number_1,"is greater or equal to",number_2)
else:
    print(number_2,"is greater  or equal to",number_1)
To download raw file Click Here

Output :5

Relational Operator (Greater than or  Equal to) Example
Enter number 1 : 50
Enter number 2 : 45
50 is greater or equal to 45


Source Code :6

print("Relational Operator (Less than or  Equal to) Example")
number_1=int(input("Enter number 1 : "))
number_2=int(input("Enter number 2 : "))
if number_1 <= number_2:
    print(number_1,"is less or equal to",number_2)
else:
    print(number_2,"is less  or equal to",number_1)
To download raw file Click Here

Output :6

Relational Operator (Less than or  Equal to) Example
Enter number 1 : 12
Enter number 2 : 2
2 is less  or equal to 12