Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to slice even index value from a list in python using slice function

num = [1,2,3,4,5]
res = num[slice(0, len(num), 2)]
print(res)

#[1, 3, 5]
 
PREVIOUS NEXT
Tagged: #slice #index #list #python #slice #function
ADD COMMENT
Topic
Name
1+5 =