Member-only story

How much do Python’s is Operator?

Python Coding
Aug 31, 2024

1. Comparing Small Integers

a = 100
b = 100

print(a is b)
True

2. Comparing Large Integers

a = 300
b = 300

print(a is b)
False

3. Comparing Strings

a = "hello"
b = "hello"

print(a is b)
True

4. Comparing Lists python

a = "hello"
b = "hello"

print(a is b)
True

5. Comparing Tuples

a = (1, 2, 3)
b = (1, 2, 3)

print(a is b)
False

--

--

Python Coding
Python Coding

Written by Python Coding

Learn python tips and tricks with code I Share your knowledge with us to help society. Python Quiz: https://www.clcoding.com/p/quiz-questions.html

Responses (1)