greater than and less than | Sololearn: Learn to code for FREE!

0

greater than and less than

We can use equal = and not equal != but why we can't use not greater than !> and not less than !< ???

9/22/2019 2:20:13 AM

Din Din

4 Answers

New Answer

+5

Because those operators aren't defined and you can simply use the inverse or negate the final comparison. But if you insist try !(a>b) instead of (a<b). They are equal in most respects, except the former is a tiny faction less efficient.

+3

The negation of "greater than" (>) is "less than or equal to" (<=), and viceversa. The negation of "less than" (<) is "greater than or equal to" (>=), and viceversa. [Python] print(4>2) # True print(4<=2) # False print(4<2) # False print(4>=2) # True

+3

And remember "=" is the assignment operator. "==" means "equals".

+2

Not greater than or equal to is equivalent to less than. Not less than or equal to is equivalent to more than. And You want to do: if (!(f>=0))... This