What Is the meaning of this operator- [::]. And what's the difference between these two- [:] and [::] | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What Is the meaning of this operator- [::]. And what's the difference between these two- [:] and [::]

Plz answer this question

28th May 2020, 5:48 PM
Devang Soni
Devang Soni - avatar
1 Antwort
+ 2
These are list slicing operations. They generally take index values but when they are not mentioned, it takes into consideration the default values which is shown below. spam = [1,2,3,4,5,6] // Both are same print(spam[:]) print(spam[0:len(spam)]) // Both are same print(spam[::]) print(spam[0:len(spam):1])
28th May 2020, 7:18 PM
Avinesh
Avinesh - avatar