# Python For Beginner's Day - 10

**contd...**

**Logical Operators:**

* used to combine the conditional statements.
    
    | Operator | Description |
    | --- | --- |
    | and | Returns True if both statements are true (x &lt; 4 and x &lt; 7) |
    | or | Returns True if one of the statements is true(x &lt; 4 or x &lt; 7) |
    | not | Reverse the result, returns False if the result is true |
    

**Identity Operators:**

* used to compare the objects, if they have same memory location but not with same values.
    
    | Operator | Description | Example |
    | --- | --- | --- |
    | is | Returns True if both variables are the same object | x is y |
    | is not | Returns True if both variables are not the same object | x is not y |
    
    'is' operator
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717971478971/76eb68bb-1925-4b28-bad8-fe3ddd5818a7.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717971509887/99dd7b08-45d9-42d4-aa9e-a63b6943eaa6.png align="center")
    
    'is not' operator
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717971621267/ea78fbbb-9d49-4c8e-b4d1-3cb78952297a.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717971658229/fadec5d4-16da-4522-9af9-287d2f0b8c0a.png align="center")
    
    **Membership operator:**
    
* used to test if the sequence is present in the object.
    
    | Operator | Description |
    | --- | --- |
    | in | Returns True if a sequence with the specified value is present in the object (x in y) |
    | not in | Returns True if a sequence with the specified value is not present in the object (x not in y) |
    
    **Bitwise operator:**
    
* used to compare binary numbers.
    
    | Operator | Name | Description | Example |  |
    | --- | --- | --- | --- | --- |
    | & | AND | Sets each bit to 1 if both bits are 1 | x & y |  |
    | | | OR | Sets each bit to 1 if one of two bits is 1 | x | y |  |
    | ^ |  | XOR | Sets each bit to 1 if only one of two bits is 1 | x ^ y |
    | ~ | NOT | Inverts all the bits | ~x |  |
    | &lt;&lt; | Zero fill left shift | Shift left by pushing zeros in from the right and let the leftmost bits fall off | x &lt;&lt; 2 |  |
    | \&gt;&gt; | Signed right shift | Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off | x &gt;&gt; 2 |  |
    
    & Operator:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034513353/e432ad5d-fd47-4acc-8f09-7daf8ae90293.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717973296741/7a8333d5-f9c9-404c-9643-598cd62627cf.png align="center")

| Operator :

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034438819/4eadef6a-d5a7-4dd8-8bd8-f5eac27bdbbe.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717973425528/90f9c0af-87dc-4eb5-b48c-3c8993dbe2e9.png align="center")

^ Operator :

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034311270/cc6c3544-c376-4344-8f52-643ed8685a2f.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717973594135/a3ae1515-6fdd-47d4-815c-a706dad02d73.png align="center")

~ Operator:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034620453/11183d46-061a-463a-933a-f4187772b5ef.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717973854242/3352431d-3bbc-4246-851e-f3f3f58c67f8.png align="center")

&lt;&lt; Operator:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718033888609/c397fbd9-6b6e-4217-be6b-d74e34c33d05.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718033911370/ba487cba-8732-497c-8a1d-d7c89cdc7929.png align="center")

\&gt;&gt; Operator:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034012046/d78be400-c3a2-4e0e-851c-af058e8f7adc.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718034030755/400e3cf3-35c2-4279-9eb9-959019efbfd0.png align="center")
