Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python comparison operators

# Basic syntax:
1 < b <= 3:
# Note, in Python it's common to see comparisons like:
if a < b and b <= c :
   {...}
# 	however, the above syntax can be used to express things more succintly (and
#	more similarly to the mathematical notation for inequalities)
#	Other comparison operators that can be "chained":
# 	> | < | == | >= | <= | != | is [not] | [not] in

# Example usage:
# Say you wanted to check whether your_variable was greater equal to 5 and
# also not a member of your_list, you could write this as:
5 <= your_variable not in your_list
# which will evaluate to true or false
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #comparison #operators
ADD COMMENT
Topic
Name
5+7 =