python list[::n] meaning

it returns n-th elements list from original list

a = [1,2,3,4,5,6]
a[::2] = [1,3,5] # 0th element: 1, 2nd element :3, 4th element :6

reference : https://docs.python.org/3/tutorial/datastructures.html

This work is licensed under a CC BY-ND 4.0 license. External material follows original copyright.

Creative Commons License

PREVIOUSbigdata mining 5장
NEXTHow to find a good essay