-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPython Operators Comparison .py
27 lines (21 loc) · 1.02 KB
/
Python Operators Comparison .py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Python Comparison Operators
a = 12
b = 23
# (==) Equal Operator
print(a == b) # returns False because 12 is not equal to 23
print(23 == b) # returns true because 23is is equal to 23
# (!=) Not equal Operator
print(a != b) # returns true because 12 is not equal to 23
print(23 != b) # returns false because 23 is is equal to 23
# (>) Greater than Operator
print(a > b) # returns false because 12 is not greater than 23
print(24 > b) # returns true because 24 is is greater than 23
# (<) Less than Operator
print(a < b) # returns true because 12 is less than 23
print(24 < b) # returns false because 24 is not less than 23
# (>=) Greater than or equal Operator
print(a >= b) # returns false because 12 is not greater, or equal, to 23
print(24 >= b) # returns True because 24 is greater, or equal, to 23
# (<=) Less than or equal to Operator
print(a <= b) # returns true because 12 is Less, or equal, to 23
print(24 <= b) # returns False because 24 is neither less than or equal to 23