from re import S nums = [6, 7, 8, 12, 19, 55, 90, 98]; searchItem = 7; found = False; for i,j in enumerate(nums): if j == searchItem: print(f'found {searchItem} in nums at index {i}'); found = True; break; if not found: print(f'Didn\'t find {searchItem} in nums');