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