Python – Logical Operators

Logical operators are used to combine conditional statements.

and: Returns True if both statements are true.

x = True
y = False
print(x and y)  # Output: False

or: Returns True if at least one of the statements is true.

print(x or y)  # Output: True

not: Reverses the result, returns False if the result is true.

print(not x)  # 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