Every Variables in Python has a Datatype. In Python you do not need to declare any datatypes, you just write the variable and its value.


Python automatically decide the types based on our value.


Datatypes are created when you assign the value of variables.

  Basic types:                     


                          1. Numeric

                          2. String

                          3. Boolean

1. PYTHON NUMERIC:


There are 3 types of Numeric.

  • Integers
  • Floating-point Numbers
  • Complex Numbers

1. Integers:


             When you declare numbers, it comes into the Integer datatypes.


int

2. Floating-point Numbers:


              Floating number is the decimal point numbers.

              Floating point number is up to 15 decimal places.

              E.g.   2 is integer, 2.5 is floating point number.

float

3. Complex Number:


          It is used when you have complex problem

          Its denoted by x + yj, where x and y are the real numbers and j is the imaginary unit.

complex

2 . PYTHON STRING:


String is the collection of characters.

We can use single quotes( ‘ ) or double quotes( “ ) for declaring string.

We can use triple quotes ( ‘ ‘ ‘ ) or ( “ “ “ ) for creating Multi-line strings.


string

3. PYTHON BOOLEAN:


It is used when we have binary value. It means either 0 or 1 and you can say Yes/No.

Your answer is in between true and false or 0 and 1.

boolean