If statement is used for comparing. Please look at the screenshot to see how it's done.
The if statement compares the numbers and if it is true, it returns the output and false if it is not true.
The true or false value is got by giving the comparison.
The usual comparison operators are:
(= =) - equal to
(>) - greater than
(<) lesser than
(>=) greater than or equal to
(<=) lesser than or equal to
[!=] not equal
I put them in brackets because markdown is messing with it.
We can also compare strings. Comparison is not limited to numbers alone.
These comparison operators are extremely useful.
Image source - screenshot of colab