0
a= "hello" #tab print(a[0:5:2]) what is purposes of 2
....
2 Antworten
+ 5
"...List slices can also have a third number, representing the step, to include only alternate values in the slice..."
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/?ref=app
+ 3
It's like the step amount it takes. So since it's 2 it'll print every other character in the string starting at index 0 ending at index 5 .
Index 0 = H
Index 2 = l
Index 4 = o