Skip to content

Instantly share code, notes, and snippets.

@shabbirbhimani
Created April 1, 2018 12:00
Show Gist options
  • Save shabbirbhimani/900bf65e2dd5816fcbad0ceab637cfac to your computer and use it in GitHub Desktop.
Save shabbirbhimani/900bf65e2dd5816fcbad0ceab637cfac to your computer and use it in GitHub Desktop.
Logical Operators
# 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