The Data types in Python are :

Primitive data types are stored in stack memory.- boolean
- byte
- list
- tuple
- dict
- Complex Number
- float
- long
- string

**boolean:**

Valid values: true, false

Default value: false

Size: 1 bit

**Python Code:**

isEnabled = True

Byte:

**Python Code:**

b'Python'

List:

**Python Code:**

listOfFruits = ["apples", "mango", "bananas"]

Tuple:

**Python Code:**

listOfVegetables = ("carrot", "brinjal", "cauliflower")

Dict:

**Python Code:**

numberDictionary = {"ONE" : 1, "TWO" :2}

Complex Number:

**Python Code:**

z = 2+3j

float:

**Python Code:**

x = 2.3

long:

**Python Code:**

bigValue = 1094324242344L

string:

**Python Code**

x = "The Quick Brown Fox Jumps Over The Lazy Dog"

**Python Operators:**

Listed below are various operators available in Python. A brief description is provide with the operators and an example of most commonly used operators is provided to end this blog.

**Multiplication/division operators:**

* : It multiples the left and right operand and returns the result.

% : Modulo operator. Divides the left operand with the right operand and returns the remainder.

/ : Division Operator. Divides the left operand and returns the result.

**Additional / Subtraction :**

+ : Addition Operator. Adds the left operand with the right operand and returns the result.

- : Subtraction Operator. Subtracts the left operand and right operand and returns the result.

**Shift Operators :**

<< : Left Shift Operator. Moves the left operand to the left by the number of bits specified by the right operand.

>> : Right Shift Operator. Moves the left operand to the left by the number of bits specified by the right operand.

**Relational Operators :**

< : Less than Operator. Check if the left operand is less than the right operand. Return True or False.

> : Greater than Operator. Check if the left operand is greater than the right operand. Return True or False.

>= : Greater than or equal to. Check if the left operand is greater than or equal to the right operand . Return True or False.

is : Instance of Operator. Check if the left operand is instance of right operand. Example: Is Dog Animal. True. Is Dog Plant. False.

**Equality :**

== : Check if left operand is equal to the right operand. Return True or False.

!= : Check if left operand is not equal to the right operand. Return True or False.

**Bitwise AND :**

& : Bitwise AND Operator. If bit exists in both left and right operand, copy the bit to the result.

**Bitwise exclusive OR :**

^ : Bitwise XOR Operator. If bit is set in either left or right operand but not in both, copy the bit to the result.

**Bitwise inclusive OR :**

| : Bitwise OR Operator. If bit exists in either left to right operand is true, the result will be true else false.

**Logical AND :**

and : Logical AND Operator. If both left and right operand is true, the result will be true else false.

**Logical OR :**

or : Logical OR Operator. If Either left or right operand is true, the resultwill be true or false.

**Assignment Operator :**

= : Assignment operator. Assign the right operand to the left operand.

+= : Add plus assignment operator. Adds the left and right operand AND assigns the result to the left operand

-= : Subtract plus assignment operator. Subtract the left and right operand AND assigns the result to the left operand.

*= : Multiples plus assignment operator. Multiplies the left and right operand AND assigns the result to the left operand.

/= : Divides plus assignment operator. Divides the left and right operand And assigns the result to the left operand.

%= : Modulo plus assignment operator. Divides the left and right operand AND assigns the remainder to the left operand.

&= : Bitwise AND plus assignment operator.

^= : Bitwise OR plus assignment operator.

>>= : Right shift plus assignment operator.

ReplyDeletenice article for beginners.thank you.

javacodegeeks

welookups python