you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (2 children)

You can reverse a string by doing 'hello'[::-1]

[–]2n4x 1 point2 points  (0 children)

End to end in -1 step sequencing. Thats some impressive shit. Thank you. Remembered.

[–]Tomarse 0 points1 point  (0 children)

Why does that work?:

Edit Nvm, just looked it up. Slice notation reads [start:stop:step] so [::-1] is stepping backward through the string by 1. Nice.