Python – Comparison Operators

Comparison operators are used to compare two values.

Equal (==): Checks if two operands are equal.

print(a == b)  # Output: False

Not Equal (!=): Checks if two operands are not equal.

print(a != b)  # Output: True

Greater Than (>): Checks if the first operand is greater than the second.

print(a > b)  # Output: True

Less Than (<): Checks if the first operand is less than the second.

print(a < b)  # Output: False

Greater Than or Equal To (>=): Checks if the first operand is greater than or equal to the second.

print(a >= b)  # Output: True

Less Than or Equal To (<=): Checks if the first operand is less than or equal to the second.

print(a <= b)  # Output: False

Tutorials Deck

TutorialsDeck is striving to provide the best learning material on technical and non-technical subjects.

Languages

Web Technologies

Database

Trending Technologies

© 2024. All rights reserved.

Contact Us @ tutorialsdeck06@gmail.com