Python Program to Slice Lists (Get the Items at Specified Intervals)

bookmark

my_list = [1, 2, 3, 4, 5]

print(my_list[::2])

 

Output

[1, 3, 5]