+ 2
How to reverse this word using string slicing
#[start:stop:step] 'hello'
8 Réponses
+ 4
reverse_word = 'hello'[-1::-1]
+ 5
- using start index -1 target the last index
- don't specify the stop index implicitly mean without end (while there's characters)
- using -1 at step will decrease index
So you get all characters from last (4) to first (0)
+ 5
So, you can upvote, and mark one as 'best answer', as you first do, but immediatly undo ;P
+ 2
ok I will
+ 1
pls explain this
+ 1
super explanation
+ 1
thq so much
0
a='It is being just fine before I meet you'
print(a[::-1])