list comprehension index value python code example Example: python list comprehension index, value list2 = [x for ind, x in enumerate(list1) if 4 > ind > 0]