- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is "not in" operator in Python?
In Python, 'not in' membership operator evaluates to true if it does not finds a variable in the specified sequence and false otherwise. For example
>>> a = 10 >>> b = 4 >>> l1 = [1,2,3,4,5] >>> a not in l1 True >>> b not in l1 False
Since 'a' doesn't belong to l1, a not in b returns True. However, b can be found in l1, hence b not in l1 returns False
Advertisements