Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

find an item in a list python

stuff = ['book', 89, 5.3, True, [1, 2, 3], (4, 3, 2), {'dic': 1}]
print('book' in stuff)          # Output: True
print('books' in stuff)         # Output: False
# Remember it is case-sensitive
print('Book' in stuff)          # Output: False
print([1,2,3] in stuff)         # Output: True
print([1,2,3] not in stuff)     # Output: False
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #find #item #list #python
ADD COMMENT
Topic
Name
8+8 =