list comprehension index code example
Example 1: python list comprehension index, value
list2 = [x for ind, x in enumerate(list1) if 4 > ind > 0]
Example 2: list comprehension
# List comprehension
list_comp = [i+3 for i in range(20)]
# above code is similar to
for i in range(20):
print(i + 3)