Data-type In Python


Data types in any programming language are to identify or to define the type of data a variable holds in.

Python is a dynamically typed language. The interpreter implicitly binds the data with its type. Therefore it is not at all required for a variable to mention the type of date it is storing in, no compile-time error will be prompted.

EXAMPLE

d=5.

The variable "a" holds integer value five and we did not define the type of data it is. Python interpreter will automatically interpret variables as an integer type. This is the actual meaning of the python interpreter implicitly binding to its corresponding data type.

Python provides a special function type() which returns the data type of the variable passed.

Example:Int

x = 30 print(x) y= 50 print(y) z=x+y print(z)

OUTPUT:

30
50
80

Example:(Float)

x = 30.2 print(x) y= 50.6 print(y) z=x+y print(z)

OUTPUT:

30.2
50.6
80.8

Example:(Complex)

x = 30j print(x) y= 50j print(y)

OUTPUT:

30j
50j