What is this: [:index] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is this: [:index]

In this section it has new code not covered yet I guess. [:index] how does this work?

22nd Jul 2019, 12:57 AM
Ashkan Imanzahrai
1 Answer
+ 2
It means from the beginning till "index" excluding the index so for example if I have a = "12345678" print(a[:5]) It will print a starting from index 0 to index 4, leaving the output like this: 12345
22nd Jul 2019, 1:56 AM
alvaro.pkg.tar.zst
alvaro.pkg.tar.zst - avatar