Comparison Operator in Python

 Python Comparison Operators:

 Assume a = 10 and b = 20 then:

== Checks if the value of two operands are equal or not, if yes then condition becomes true. (a == b) is not true.

!= Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. (a != b) is true.

> Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (a > b) is not true.

< Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (a < b) is true.

>= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (a >= b) is not true.

<= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (a <= b) is true.

Comments

  1. The result of this comparison will be a boolean value—true or false—based on the relationship between the two operands. If a is greater than or equal to b, the condition evaluates to true; otherwise, it evaluates to false.http://www.vataliyacomputer.in/python-coding-programming-class.php

    ReplyDelete

Post a Comment

Popular posts from this blog

Testing in Python and types of software testing

First Program in Python