Skip to content

Commit fa8f8fa

Browse files
authored
To learn concept of ID and DataType
1 parent cb1cc7a commit fa8f8fa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

demo.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
x=11
2+
print(x)
3+
print("data type of x",type(x))#x is object of class int and class is user define data type so data type of x is class int
4+
print("id of x:",id(x))#gives uique id
5+
6+
7+
y=12
8+
z=12
9+
print("id of y:",id(x))#id of y and z is same bacause reffering to same value so refference count of 12 is 2
10+
print("id of z:",id(z))
11+
12+
13+
z=z+1
14+
print("id of z:",id(z))#id will change because now y and z not reffering to same value i.e 11 now z having value 13

0 commit comments

Comments
 (0)