Data type informs to the PVM (Python Virtual Machine) what type of data
present inside a variable (object reference).
In python, we are not required to specify the data type. Based on the
data, the data type will be assigned automatically hence Python is Dynamically Typed Language.
In c /java language we should write data types explicitly.
Remember one thing in Python, everything is treated as object. You will be known in future sessions what is object.
Remember one thing in Python, everything is treated as object. You will be known in future sessions what is object.
Ex: C language example program how we use data types for variable initialization
#include<stdio.h>
void main()
{
int a=5;
float b=2.4;
char *=”Python\0”;
}
Example program in Python:
>>> a=5 # Here 5 integer value.
>>> print(type(a)) # type() is used to find the data type of object
Result is:
<class 'int'>
>>> print(id(a)) # id() function is used to find the address of the object
Result is:
1526782192
>>> print(a) # value of the object
Result is:
5
Example program in Python:
>>> a=5 # Here 5 integer value.
>>> print(type(a)) # type() is used to find the data type of object
Result is:
<class 'int'>
>>> print(id(a)) # id() function is used to find the address of the object
Result is:
1526782192
>>> print(a) # value of the object
Result is:
5
Types of Data types:
1. Built-in Data types (Basic Data types)
2. Derived Data types
3. User-defined data types
Previous topic: Variable
Next topic :Built-in Data types
Click here to see related videos
You may like the following posts:
hi sir
ReplyDeletemy name is v.gayathri,from siddhartha degree college nuzvid,
i want a material for python from starting onwards ,because i joined the class before a week. so i think you may send the material from starting onwards
You can access previous links to take notes.https://www.youtube.com/watch?v=aSeMyoERwOU
ReplyDelete