Question #127

What is the output of the code snippet below?
a = 1
b = 1
print(a is b)

As 1 is non mutable, Python does not create a new memory address for it. As both a and b refer to 1 , they both have the same id (the id of 1 ) and as a result, they are considered as the same object by Python. (

Comment on Disqus:

Comment on Twitter:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

Similar questions: