Skip to content

Commit 22a4d1f

Browse files
committed
Added identity_operators.py to Python-Basic-to-Advance repo
1 parent 3fe9044 commit 22a4d1f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

identity_operators.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
a=5
2-
b=2
3-
c='5'
1+
a = "Amrata"
2+
b = "amrata"
3+
c = '5'
4+
45
print(a is b)
6+
57
print(a is not c)
8+
69
print(id(a))
7-
print(id(b))
8-
print(id(c))
10+
11+
List1=["Amrata","Hrutuja"]
12+
List2=["Amrata","Hrutuja"]
13+
print(List1 is not List2)
14+
print(id(List1))
15+
print(id(List2))
16+
#- Small integers (usually from -5 to 256) are pre‑allocated and reused.
17+
#- In Python, every time you create a new list with [...], Python allocates a new object in memory.

0 commit comments

Comments
 (0)