Comparison Operator Python || Operator Overloading || Python
In this we are going to see a basic example of comparison operator using operator overloading in Python Programming Language.



class Point:
    def __init__(self, X):
        self.X = X

    def __gt__(self, U):
        if(self.X > U.X):
            return True
        else:
            return False

object_1 = Point(int(input("Please enter the value: ")))
object_2 = Point(int(input("Please enter the value: ")))
if(object_1 > object_2):
    print("The object_1 is greater than object_2")
else:
    print("The object_2 is greater than object_1")

# Coded by Dhiraj Shelke


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post