4. Making Comparisons
There are six possible comparisons that can be made in Python:
>=greater than or equal to
<=smaller than or equal to
For example, we can make comparisons in Python between two numbers:
In the above, by inputting
1==1is same as asking Python this question: Is 1 equal to 1”? (The answer is yes.) The result of these comparison is a data type called Boolean, which has only two possible values:
You can also compare if two strings are equal in Python.
We can also ask Python to find out if a string is contained within a string using the “in” comparison operator.
"H" in "Hello"
"h" in "Hello"