Created
April 1, 2018 12:00
-
-
Save shabbirbhimani/900bf65e2dd5816fcbad0ceab637cfac to your computer and use it in GitHub Desktop.
Logical Operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Declare variable1 as 100 and variable as 200 | |
variable1 = 100 | |
variable2 = 200 | |
print("value of variable1", variable1) | |
print("value of variable2", variable2) | |
# performing and operation | |
andOutput = variable1 > 90 and variable1 < 105 | |
print("is vairable1 greater than 90 and less than 105", andOutput) | |
# output: is vairable1 greater than 90 and less than 105 True | |
# performing or operation | |
orOperation = variable1 > variable2 or variable2 < 12 | |
print("variable1 is greater than variable2 or variable2 less than 12", orOperation) | |
# output: variable1 is greater than variable2 or variable2 less than 12 False | |
# performing not operation | |
notOperation = not variable1 > variable2 | |
print(" not variable1 > variable2", notOperation) | |
# output: not variable1 > variable2 True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment