How to search a item from a list?

You should at least write in a better way, like:

lst=[5,9,2,5,13] 
item = int(input("Please enter the search item."))
found = False
for search in range(len(lst)):
    if item == (lst[search]):
        found = True
if found:
    print('{} is in the list'.format(item))
else:
    print('{} is not in the list'.format(item)) 

Leave a Comment