Loading...
PythonUncategorized

Data Types of Python

Datatype represent the type of data present inside a variable.
in Python we are not required ti specify the type explicitly. Based on value provided, the type will be assigned automatically. Hence Python is Dynamically Typed Language.

It contains the following inbuilt data types
1.int
2. float
3. complex
4. bool
5. str
6. bytes
7. bytearray
8. range
9. list
10. tuple
11. set
12. frozenset
13. dict
14. None

  1. int datatype:
    We use int datatype to represent whole numbers(integral values) that are stored manipulated and
    Eg:
    a=5
  2. float datatype:
    We use float datatype to represent forward decimal (decimal values) or scientific notations. In decimal number, decimal point is used while in scientific notation exponent is used.
    Eg:
    f=1.15
  3. Complex datatype:
    A complex number is an unordered pair contains of floating point real number and imaginary number. 
    Syntax:
    real+imagj
    Eg:
    5+2j
  4. bool datatype:
    This datatype is used to represent boolean values i.e., true or false.
    Internally Python represents True as 1 and False as 0.
    Eg:
    a=10<20
    print(x)
    True.
  5. str type:
    str function represents String datatype.
    String is a sequence of characters which is enclosed in single quotes or double quotes. But, by using single or double quotes we cannot represent multi line strings.
    For multi line string we should use triple single quotes or triple double quotes.
    Eg:
    name=”XYZ”

Leave a Reply

Your email address will not be published. Required fields are marked *