Thursday, June 6, 2019

Python Comparison Operator

Python Comparison Operator 


# Operator Description Example
# ==       If the values of two operands are equal, then the condition becomes true. (a == b) is not true.
# !=       If values of two operands are not equal, then condition becomes true. (a != b) is true.
# >       If the value of left operand is greater than the value of right operand, then condition becomes true. (a > b) is not true.
# <       If the value of left operand is less than the value of right operand, then condition becomes true. (a < b) is true.
# >=       If the value of left operand is greater than or equal to the value of right operand, then condition becomes true. (a >= b) is not true.
# <=       If the value of left operand is less than or equal to the value of right operand, then condition becomes true. (a <= b) is true.a=9

a=9
b=2

#Comparison Operation returns only boolean value (True/False)
print (a==b)
#output would be
#False
print (a!=b)
#output would be
#True
print (a>b)
#output would be
#True
print (a<b)
#output would be
#False
print (a>=b)
#output would be
#True
print (a<=b)
#output would be
#False


print (a and b)



2 comments:

  1. I must appreciate you for providing such a valuable content for us. I found so many interesting stuff in your blog Helped a lot in increasing my knowledge eBay contact telefoonnummer

    ReplyDelete

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...