Learn Before
Relation
Demonstration of the id() function
str1 = "geek" print(id(str1))
str2 = "geek" print(id(str2))
This will return True
print(id(str1) == id(str2))
str3 = "smart" print(id(str3))
This will return False
print(id(str1) == id(str3))
Output: 140252505691448 140252505691448 True 140252505691840 False
0
1
Updated 2021-02-02
Tags
Python Programming Language
Data Science