Python | sympy.compare() method
With the help of
sympy.compare() method, we can compare the variables and it will return 3 values i.e -1 for smaller, 0 for equal and 1 for greater by using
Return : Return the value of comparison i.e -1, 0, 1.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Example #1 :
In this example we can see that by using
sympy.compare() method, we are able to compare the variables and return 3 values i.e -1 for smaller, 0 for equal and 1 for greater.
Example #2 :
Example #3 :