[:x] syntax python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

[:x] syntax python

Can anyone explain me how this syntax [:x], [::-x] in Python works, when is it used and what are all types of this thing.

7th Oct 2020, 12:09 AM
Kim Jong
2 Answers
+ 5
It's called list slicing: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/?ref=app We have a Python course here in SoloLearn, check it out.
7th Oct 2020, 12:23 AM
Kevin ★
0
Kim Jong It is called list slicing:- [:x] means it will consider all the numbers from 0 to x-1.... [::-x] means it will print the list in reverse order....
7th Oct 2020, 4:31 AM
Indira
Indira - avatar