• Operators

    Logical operators in programming are like a set of tools that help us decide what to do depending on how things look. Logical operators tell the computer to do something based on how two different things compare.

      • Increment Operators

      • The increment operator increments the value of a single variable.

      • Python

        Example of increment operator in python.
        # NA
      • Decrement Operators

      • The decrement operator decrements the value of a single variable.

      • Python

        Example of decrement operator in python.
        # NA
      • Addition Arithmetic Operators

      • The addition operator returns the sum of two variables.

      • Python

        Example of addition operator in python.
        age = 20
        
        print(age + 1) # 21
        
      • Subtraction Arithmetic Operators

      • The subtraction operator returns the difference of two variables.

      • Python

        Example of subtraction operator in python.
        age = 20
        
        print(age - 2) # 18
        
      • Multiplication Arithmetic Operators

      • The multiplication operator returns the product of two variables.

      • Python

        Example of multiplication operator in python.
        age = 20
        
        print(age * 3) # 60
        
      • Division Arithmetic Operators

      • The division operator returns the quotient of two variables.

      • Python

        Example of division operator in python.
        age = 20
        
        print(age / 2) # 10
        
      • Modulus Arithmetic Operators

      • The modulus operator returns the remainder of two variables.

      • Python

        Example of modulus operator in python.
        age = 20
        
        print(age % 9) # 2
        
      • Exponentiation Arithmetic Operators

      • The exponentiation operator returns the power of two variables.

      • Python

        Example of exponentiation operator in python.
        age = 2
        
        print(age ** 3) # 8
        
      • Addition Assignment Arithmetic Operators

      • The addition assignment operator returns the sum of two counterparts.

      • Python

        Example of addition assignment operator in python.
        age = 20
        
        age += 1
        
        print(age) # 21
        
      • Subtraction Assignment Arithmetic Operators

      • The subtraction assignment operator returns the difference of two counterparts.

      • Python

        Example of subtraction assignment operator in python.
        age = 20
        
        age -= 2
        
        print(age) # 18
        
      • Multiplication Assignment Arithmetic Operators

      • The multiplication assignment operator returns the product of two counterparts.

      • Python

        Example of multiplication assignment operator in python.
        age = 20
        
        age *= 3
        
        print(age) # 60
        
      • Division Assignment Arithmetic Operators

      • The division assignment operator returns the quotient of two counterparts.

      • Python

        Example of division assignment operator in python.
        age = 20
        
        age /= 2
        
        print(age) # 10.0
        
      • Modulus Assignment Arithmetic Operators

      • The modulus assignment operator returns the remainder of two counterparts.

      • Python

        Example of modulus assignment operator in python.
        age = 20
        
        age %= 9
        
        print(age) # 2
        
      • Exponentiation Assignment Arithmetic Operators

      • The exponentiation assignment operator returns the power of two counterparts.

      • Python

        Example of exponentiation assignment operator in python.
        age = 2
        
        age **= 3
        
        print(age) # 8
        
      • Equal Comparison Operators

      • The equal operator checks if two variables are equal value.

      • Python

        Example of equal operator in python.
        age = 20
        
        print(age == 20) # True
        
      • Equal Type Comparison Operators

      • The equal type operator checks if two variables are equal value and type.

      • Python

        Example of equal type operator in python.
        age = '20'
        
        print(age == '20') # True
        
      • Not Equal Comparison Operators

      • The not-equal operator checks if two variables are not equal value.

      • Python

        Example of not-equal operator in python.
        age = 20
        
        print(age != 18) # True
      • Not Equal Type Comparison Operators

      • The not-equal type operator checks if two variables are not equal value and type.

      • Python

        Example of not-equal type operator in python.
        age = 20
        
        print(age != '20') # True
        
      • Greater Than Comparison Operators

      • The greater-than operator checks if the value of the first variable is greater than the second.

      • Python

        Example of greater-than operator in python.
        age = 20
        
        print(age > 18) # True
      • Less Than Comparison Operators

      • The less-than operator checks if the value of the first variable is less than the second.

      • Python

        Example of less-than operator in python.
        age = 20
        
        print(age < 21) # True
      • Greater Than or Equal Comparison Operators

      • The greater-than or equal-to operator checks if the value of the first variable is greater than or equal to the second.

      • Python

        Example of greater-than or equal-to operator in python.
        age = 20
        
        print(age >= 20) # True
      • Less Than or Equal Comparison Operators

      • The less-than or equal-to operator checks if the value of the first variable is less than or equal to the second.

      • Python

        Example of less-than or equal-to operator in python.
        age = 20
        
        print(age <= 20) # True
      • And Logical Operators

      • The and operator checks if the value of the first and second variable are true.

      • Python

        Example of and operator in python.
        Coming Soon
      • Or Logical Operators

      • The or operator checks if either the value of the first or second variable is true.

      • Python

        Example of or operator in python.
        Coming Soon
      • Xor Logical Operators

      • The xor operator checks if either the value of the first or second variable is true, but not both.

      • Python

        Example of xor operator in python.
        Coming Soon