Sitemap

Special Python Operators : in & is

Jan 21, 2023

--

in operator

The power of inbuilt operators in Python doesn’t stop surprising me. Perhaps one of the most powerful operators I have come across is the operator: in

This operator returns a boolean value.

Get Bharath Urs’s stories in your inbox

Join Medium for free to get updates from this writer.

It can be used with a str or a list.

list

Case Sensitive — so “godfather” will fail

str

see — it works with str !

is operator

Similar to in, is returns a boolean. is compares two variables to tell us if the id is the same:

a = 42
b = 13

if (a is b):
pass

--

--

Bharath Urs
Bharath Urs

Written by Bharath Urs

Don't follow me - I use Medium to make notes for my own self : ) - My notes are rough and are useless to pretty much anyone else other than me.