Relational and logical operators

Relational operators are used to compare values with each other. They return a logical result: true or false. Values that are linked with relational operators are called elementary statements in propositional logic.
A typical example of a Boolean logical operator is the and operation: It always returns true if all operands are also true.

<=less than or equal to
>=greater than or equal to
notexpression is false
andboth expressions are true
orat least one expression is true


Code Explanation

1Initializes the variables
a with value 0,
b with value 4,
i with value 10
2As long as the value of a is not equal to b and i is greater than or equal to the product of a and b
3the values of variable a and b are output with the indication that the two variables are not equal
4Increases the value of the variable a by 1
6As soon as the condition of the while loop is no longer true, both values are equal and are output
a, b, i = 0, 4, 10
while a != b and i >= a + b:
    print(str(a)+ " is unequal " + str(b))
    a = a + 1

print(str(a) + " is equal " + str(b))
0 is unequal 4
1 is unequal 4
2 is unequal 4
3 is unequal 4
4 is equal 4