Python Logical Operators Example

Rate this post



x = True
y = False
print(‘x and y is’,x and y)
print(‘x or y is’,x or y)
print(‘not x is’,not x)


x and y is False
x or y is True
not x is False

Few more example:


if (five == 5) AND (two == 2):

print five, two


if not (age >= 17):

print(“Hey, you’re too young to get a driving licence!”)


if not ((sword_charge >= 0.90) and (shield_energy >= 100)):

print(“Your attack has no effect, the dragon fries you to a crisp!”)


print(“The dragon crumples in a heap. You rescue the gorgeous princess!”)


 Think about more program and share your program output as comment

For any query or issue, feel free to discuss on

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

%d bloggers like this: