bluehost

Showing posts with label python relationals. Show all posts
Showing posts with label python relationals. Show all posts

Thursday, 25 February 2021

python Comparisons And Boolean Symbols.

Python comparisons are also called Relational operators. They are used to compare the values on either side of them and decide the relations among them.
Operators like equal to==, Not equal to!=, Greater than>, less than<, greater than or equal to>=, less than or equal to <= are used to compare values in python.

Python Booleans.
In python, the boolean data type is either True or False. The true or false keywords are used to define boolean variables.

Examples.

Equal to(==).
If the values on either side of the operator are equal, the outcome is true else false.
Print(2==3)
Outcome False. Because two and three are not the equal to each other.
Print(5==5)
Outcome True. Because the two are equal to each other.

Not equal (!=)
operator not equal evaluates to true if the items being compared are not equal and false if they are equal.
Print(1!=1)
False. Because one is equal to one.
Print(7!=11)
True.
Print(2!=7)
True.

Greater than(>).
Evaluates to True if the values on the left operand are greater than the values on the right operand.
Print(11>7)
True.
Print(6>6)
False.

Less than(<)
Less than evaluates to True if the value of the right operand is less than the value of the left operand.
Print(8<7)
False.
Print(7<9)
True.

Greater than or equal to(>=).
This comparison evaluates to True when comparing equal numbers. If the value of the left operand is greater than or equal to the value of the right operand, the condition becomes True.
Print(3>=9)
False. Because three is neither equal to nor greater than nine.
Print(7>=7)
True.
Print(6>=5)
True. Because six is greater than five.

Smaller than or equal to(<=)
If the value of the right operand is less than or equal to the value of the left operand, the condition becomes True.
Print(6<=5)
False
Print(3<=3)
True. three is equal to three and so the outcome is true.
Print(7<=8)
True

In conclusion, all of these python relational operators are very important for future coding. You need to master them keenly.

React vs Angular; Front-End Web Development

Angular and React  are two of the most popular Javascript tools for front-end development. React is a Javascript created by Meta...