Syntax error What does 'not in' operator do in Python?

What does 'not 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 not in operator returns false if object is present in sequence, true if not found

>>> 'p' not in 'Tutorialspoint'
False
>>> 'c' not in 'Tutorialspoint'
True
>>> 10 not in range(0,5)
Updated on: 2020-02-26T10:40:31+05:30

349 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements