If statements and comparisons

filler(58)
Published in
#coding
Words
70
Reading
1 min
7y
Listen to this post
~1 min

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.

Capture.JPG

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

If statements and comparisons | Ecency