0
How this slicing works ?
name = "santhosh" print(name[7:0:-1]) Output : hsohtna
2 Réponses
+ 8
string[start:stop:step]
you understand indexing? its basically counting every character in a string, but it starts at 0.
-1 is the last value.
start - what index to start counting from (included)
stop - what index to stop counting at (excluded)
step - DEFAULT = 1. How to get from the start to the
stop. Anything negative just means
backwards.
+ 2
Thank you for your answer Slick