Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

What Does 'in' Operator Do in Python



In Python, in and not in operators are called membership operators. Their purpose is to check if an object is a member of a certain sequence object like string, list, or tuple. The in operator returns true if object is present in sequence, false if not found

>>> 'p' in 'Tutorialspoint'
True
>>> 'c' in 'Tutorialspoint'
False
>>> 10 in range(0,5)
False


Updated on: 2020-02-26T10:41:06+05:30

596 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements