Replace string order in Python

Asked 2 years ago, Updated 2 years ago, 13 views

"qwer" "werq" but I couldn't, so I'm asking you a question

python

2022-09-22 08:23

1 Answers

Oh, my. You must have had a hard time. String Indexing SlicingIf you know it, it ends in one line...
DEMO

def shift_first_letter(str) :
    return str[1:] + str[0]


2022-09-22 08:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.